本文整理汇总了Java中javax.management.remote.JMXConnectionNotification.FAILED属性的典型用法代码示例。如果您正苦于以下问题:Java JMXConnectionNotification.FAILED属性的具体用法?Java JMXConnectionNotification.FAILED怎么用?Java JMXConnectionNotification.FAILED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.remote.JMXConnectionNotification
的用法示例。
在下文中一共展示了JMXConnectionNotification.FAILED属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleNotification
@SuppressWarnings("unchecked")
@Override
public void handleNotification(Notification notification, Object handback)
{
switch (notification.getType())
{
case "progress":
String tag = (String) notification.getSource();
if (this.isInterestedIn(tag))
{
Map<String, Integer> progress = (Map<String, Integer>) notification.getUserData();
String message = notification.getMessage();
ProgressEvent event = new ProgressEvent(ProgressEventType.values()[progress.get("type")],
progress.get("progressCount"),
progress.get("total"),
message);
this.progress(tag, event);
}
break;
case JMXConnectionNotification.NOTIFS_LOST:
handleNotificationLost(notification.getTimeStamp(), notification.getMessage());
break;
case JMXConnectionNotification.FAILED:
handleConnectionFailed(notification.getTimeStamp(), notification.getMessage());
break;
case JMXConnectionNotification.CLOSED:
handleConnectionClosed(notification.getTimeStamp(), notification.getMessage());
break;
}
}
示例2: sendConnectionNotificationFailed
/**
* sends a "Connection failed" notification to listeners
*/
public void sendConnectionNotificationFailed() {
JMXConnectionNotification notification = new JMXConnectionNotification(
JMXConnectionNotification.FAILED, connector, getConnectionId(), getNextNotificationNumber(),
"Connection failed", null);
sendNotification(notification);
}
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:9,代码来源:ProActiveConnectionNotificationEmitter.java
示例3: fetchNotifs
protected NotificationResult fetchNotifs(long clientSequenceNumber,
int maxNotifications,
long timeout)
throws IOException, ClassNotFoundException {
boolean retried = false;
while (true) { // used for a successful re-connection
// or a transient network problem
try {
return connection.fetchNotifications(clientSequenceNumber,
maxNotifications,
timeout); // return normally
} catch (IOException ioe) {
// Examine the chain of exceptions to determine whether this
// is a deserialization issue. If so - we propagate the
// appropriate exception to the caller, who will then
// proceed with fetching notifications one by one
rethrowDeserializationException(ioe);
try {
communicatorAdmin.gotIOException(ioe);
// reconnection OK, back to "while" to do again
} catch (IOException ee) {
boolean toClose = false;
synchronized (this) {
if (terminated) {
// the connection is closed.
throw ioe;
} else if (retried) {
toClose = true;
}
}
if (toClose) {
// JDK-8049303
// We received an IOException - but the communicatorAdmin
// did not close the connection - possibly because
// the original exception was raised by a transient network
// problem?
// We already know that this exception is not due to a deserialization
// issue as we already took care of that before involving the
// communicatorAdmin. Moreover - we already made one retry attempt
// at fetching the same batch of notifications - and the
// problem persisted.
// Since trying again doesn't seem to solve the issue, we will now
// close the connection. Doing otherwise might cause the
// NotifFetcher thread to die silently.
final Notification failedNotif =
new JMXConnectionNotification(
JMXConnectionNotification.FAILED,
this,
connectionId,
clientNotifSeqNo++,
"Failed to communicate with the server: " + ioe.toString(),
ioe);
sendNotification(failedNotif);
try {
close(true);
} catch (Exception e) {
// OK.
// We are closing
}
throw ioe; // the connection is closed here.
} else {
// JDK-8049303 possible transient network problem,
// let's try one more time
retried = true;
}
}
}
}
}
示例4: gotIOException
@Override
public void gotIOException(IOException ioe) throws IOException {
if (ioe instanceof NoSuchObjectException) {
// need to restart
super.gotIOException(ioe);
return;
}
// check if the connection is broken
try {
connection.getDefaultDomain(null);
} catch (IOException ioexc) {
boolean toClose = false;
synchronized(this) {
if (!terminated) {
terminated = true;
toClose = true;
}
}
if (toClose) {
// we should close the connection,
// but send a failed notif at first
final Notification failedNotif =
new JMXConnectionNotification(
JMXConnectionNotification.FAILED,
this,
connectionId,
clientNotifSeqNo++,
"Failed to communicate with the server: "+ioe.toString(),
ioe);
sendNotification(failedNotif);
try {
close(true);
} catch (Exception e) {
// OK.
// We are closing
}
}
}
// forward the exception
if (ioe instanceof ServerException) {
/* Need to unwrap the exception.
Some user-thrown exception at server side will be wrapped by
rmi into a ServerException.
For example, a RMIConnnectorServer will wrap a
ClassNotFoundException into a UnmarshalException, and rmi
will throw a ServerException at client side which wraps this
UnmarshalException.
No failed notif here.
*/
Throwable tt = ((ServerException)ioe).detail;
if (tt instanceof IOException) {
throw (IOException)tt;
} else if (tt instanceof RuntimeException) {
throw (RuntimeException)tt;
}
}
throw ioe;
}