Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
forked from Stefan/Java8Source
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (2)
master
develop
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
The license selected for the repository is subject to the license used by the main branch of the repository.
master
Branches (2)
master
develop
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (2)
master
develop
Java8Source
/
src
/
javax
/
management
/
Notification.java
Java8Source
/
src
/
javax
/
management
/
Notification.java
Notification.java 12.47 KB
Copy Edit Raw Blame History
Stefan authored 2020年08月11日 23:17 +08:00 . 初始化
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
/*
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.management;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
import java.util.EventObject;
import java.security.AccessController;
import com.sun.jmx.mbeanserver.GetPropertyAction;
/**
* <p>The Notification class represents a notification emitted by an
* MBean. It contains a reference to the source MBean: if the
* notification has been forwarded through the MBean server, and the
* original source of the notification was a reference to the emitting
* MBean object, then the MBean server replaces it by the MBean's
* ObjectName. If the listener has registered directly with the
* MBean, this is either the object name or a direct reference to the
* MBean.</p>
*
* <p>It is strongly recommended that notification senders use the
* object name rather than a reference to the MBean object as the
* source.</p>
*
* <p>The <b>serialVersionUID</b> of this class is <code>-7516092053498031989L</code>.
*
* @since 1.5
*/
@SuppressWarnings("serial") // serialVersionUID is not constant
public class Notification extends EventObject {
// Serialization compatibility stuff:
// Two serial forms are supported in this class. The selected form depends
// on system property "jmx.serial.form":
// - "1.0" for JMX 1.0
// - any other value for JMX 1.1 and higher
//
// Serial version for old serial form
private static final long oldSerialVersionUID = 1716977971058914352L;
//
// Serial version for new serial form
private static final long newSerialVersionUID = -7516092053498031989L;
//
// Serializable fields in old serial form
private static final ObjectStreamField[] oldSerialPersistentFields =
{
new ObjectStreamField("message", String.class),
new ObjectStreamField("sequenceNumber", Long.TYPE),
new ObjectStreamField("source", Object.class),
new ObjectStreamField("sourceObjectName", ObjectName.class),
new ObjectStreamField("timeStamp", Long.TYPE),
new ObjectStreamField("type", String.class),
new ObjectStreamField("userData", Object.class)
};
//
// Serializable fields in new serial form
private static final ObjectStreamField[] newSerialPersistentFields =
{
new ObjectStreamField("message", String.class),
new ObjectStreamField("sequenceNumber", Long.TYPE),
new ObjectStreamField("source", Object.class),
new ObjectStreamField("timeStamp", Long.TYPE),
new ObjectStreamField("type", String.class),
new ObjectStreamField("userData", Object.class)
};
//
// Actual serial version and serial form
private static final long serialVersionUID;
/**
* @serialField type String The notification type.
* A string expressed in a dot notation similar to Java properties.
* An example of a notification type is network.alarm.router
* @serialField sequenceNumber long The notification sequence number.
* A serial number which identify particular instance
* of notification in the context of the notification source.
* @serialField timeStamp long The notification timestamp.
* Indicating when the notification was generated
* @serialField userData Object The notification user data.
* Used for whatever other data the notification
* source wishes to communicate to its consumers
* @serialField message String The notification message.
* @serialField source Object The object on which the notification initially occurred.
*/
private static final ObjectStreamField[] serialPersistentFields;
private static boolean compat = false;
static {
try {
GetPropertyAction act = new GetPropertyAction("jmx.serial.form");
String form = AccessController.doPrivileged(act);
compat = (form != null && form.equals("1.0"));
} catch (Exception e) {
// OK: exception means no compat with 1.0, too bad
}
if (compat) {
serialPersistentFields = oldSerialPersistentFields;
serialVersionUID = oldSerialVersionUID;
} else {
serialPersistentFields = newSerialPersistentFields;
serialVersionUID = newSerialVersionUID;
}
}
//
// END Serialization compatibility stuff
/**
* @serial The notification type.
* A string expressed in a dot notation similar to Java properties.
* An example of a notification type is network.alarm.router
*/
private String type;
/**
* @serial The notification sequence number.
* A serial number which identify particular instance
* of notification in the context of the notification source.
*/
private long sequenceNumber;
/**
* @serial The notification timestamp.
* Indicating when the notification was generated
*/
private long timeStamp;
/**
* @serial The notification user data.
* Used for whatever other data the notification
* source wishes to communicate to its consumers
*/
private Object userData = null;
/**
* @serial The notification message.
*/
private String message = "";
/**
* <p>This field hides the {@link EventObject#source} field in the
* parent class to make it non-transient and therefore part of the
* serialized form.</p>
*
* @serial The object on which the notification initially occurred.
*/
protected Object source = null;
/**
* Creates a Notification object.
* The notification timeStamp is set to the current date.
*
* @param type The notification type.
* @param source The notification source.
* @param sequenceNumber The notification sequence number within the source object.
*
*/
public Notification(String type, Object source, long sequenceNumber) {
super (source) ;
this.source = source;
this.type = type;
this.sequenceNumber = sequenceNumber ;
this.timeStamp = (new java.util.Date()).getTime() ;
}
/**
* Creates a Notification object.
* The notification timeStamp is set to the current date.
*
* @param type The notification type.
* @param source The notification source.
* @param sequenceNumber The notification sequence number within the source object.
* @param message The detailed message.
*
*/
public Notification(String type, Object source, long sequenceNumber, String message) {
super (source) ;
this.source = source;
this.type = type;
this.sequenceNumber = sequenceNumber ;
this.timeStamp = (new java.util.Date()).getTime() ;
this.message = message ;
}
/**
* Creates a Notification object.
*
* @param type The notification type.
* @param source The notification source.
* @param sequenceNumber The notification sequence number within the source object.
* @param timeStamp The notification emission date.
*
*/
public Notification(String type, Object source, long sequenceNumber, long timeStamp) {
super (source) ;
this.source = source;
this.type = type ;
this.sequenceNumber = sequenceNumber ;
this.timeStamp = timeStamp ;
}
/**
* Creates a Notification object.
*
* @param type The notification type.
* @param source The notification source.
* @param sequenceNumber The notification sequence number within the source object.
* @param timeStamp The notification emission date.
* @param message The detailed message.
*
*/
public Notification(String type, Object source, long sequenceNumber, long timeStamp, String message) {
super (source) ;
this.source = source;
this.type = type ;
this.sequenceNumber = sequenceNumber ;
this.timeStamp = timeStamp ;
this.message = message ;
}
/**
* Sets the source.
*
* @param source the new source for this object.
*
* @see EventObject#getSource
*/
public void setSource(Object source) {
super.source = source;
this.source = source;
}
/**
* Get the notification sequence number.
*
* @return The notification sequence number within the source object. It's a serial number
* identifying a particular instance of notification in the context of the notification source.
* The notification model does not assume that notifications will be received in the same order
* that they are sent. The sequence number helps listeners to sort received notifications.
*
* @see #setSequenceNumber
*/
public long getSequenceNumber() {
return sequenceNumber ;
}
/**
* Set the notification sequence number.
*
* @param sequenceNumber The notification sequence number within the source object. It is
* a serial number identifying a particular instance of notification in the
* context of the notification source.
*
* @see #getSequenceNumber
*/
public void setSequenceNumber(long sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}
/**
* Get the notification type.
*
* @return The notification type. It's a string expressed in a dot notation
* similar to Java properties. It is recommended that the notification type
* should follow the reverse-domain-name convention used by Java package
* names. An example of a notification type is com.example.alarm.router.
*/
public String getType() {
return type ;
}
/**
* Get the notification timestamp.
*
* @return The notification timestamp.
*
* @see #setTimeStamp
*/
public long getTimeStamp() {
return timeStamp ;
}
/**
* Set the notification timestamp.
*
* @param timeStamp The notification timestamp. It indicates when the notification was generated.
*
* @see #getTimeStamp
*/
public void setTimeStamp(long timeStamp) {
this.timeStamp = timeStamp;
}
/**
* Get the notification message.
*
* @return The message string of this notification object.
*
*/
public String getMessage() {
return message ;
}
/**
* Get the user data.
*
* @return The user data object. It is used for whatever data
* the notification source wishes to communicate to its consumers.
*
* @see #setUserData
*/
public Object getUserData() {
return userData ;
}
/**
* Set the user data.
*
* @param userData The user data object. It is used for whatever data
* the notification source wishes to communicate to its consumers.
*
* @see #getUserData
*/
public void setUserData(Object userData) {
this.userData = userData ;
}
/**
* Returns a String representation of this notification.
*
* @return A String representation of this notification.
*/
@Override
public String toString() {
return super.toString()+"[type="+type+"][message="+message+"]";
}
/**
* Deserializes a {@link Notification} from an {@link ObjectInputStream}.
*/
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
// New serial form ignores extra field "sourceObjectName"
in.defaultReadObject();
super.source = source;
}
/**
* Serializes a {@link Notification} to an {@link ObjectOutputStream}.
*/
private void writeObject(ObjectOutputStream out)
throws IOException {
if (compat) {
// Serializes this instance in the old serial form
//
ObjectOutputStream.PutField fields = out.putFields();
fields.put("type", type);
fields.put("sequenceNumber", sequenceNumber);
fields.put("timeStamp", timeStamp);
fields.put("userData", userData);
fields.put("message", message);
fields.put("source", source);
out.writeFields();
} else {
// Serializes this instance in the new serial form
//
out.defaultWriteObject();
}
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/yxljava/Java8Source.git
git@gitee.com:yxljava/Java8Source.git
yxljava
Java8Source
Java8Source
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /