sender = new PooledClusterSender();
} else if ("synchronous".equals(cluster.getSenderReplicationMode())) {
sender = new SyncClusterSender();
} else if ("asynchronous".equals(cluster.getSenderReplicationMode()) ||
"fastasyncqueue".equals(cluster.getSenderReplicationMode())) {
sender = new AsyncClusterSender();
} else {
sender = new ClusterSender();
}
ObjectName localSenderOName = senders[i];
sender.setAddress(JmxTools.getStringAttr(mBeanServer, localSenderOName, "address"));
sender.setPort(JmxTools.getIntAttr(mBeanServer, localSenderOName, "port"));
sender.setAvgMessageSize(JmxTools.getLongAttr(mBeanServer, localSenderOName, "avgMessageSize", -1));
sender.setAvgProcessingTime(JmxTools.getLongAttr(mBeanServer, localSenderOName, "avgProcessingTime", -1));
sender.setConnectCounter(JmxTools.getLongAttr(mBeanServer, localSenderOName, "connectCounter"));
sender.setDisconnectCounter(JmxTools.getLongAttr(mBeanServer, localSenderOName, "disconnectCounter"));
sender.setConnected(((Boolean) mBeanServer.getAttribute(localSenderOName, "connected")).booleanValue());
sender.setKeepAliveTimeout(JmxTools.getLongAttr(mBeanServer, localSenderOName, "keepAliveTimeout"));
sender.setNrOfRequests(JmxTools.getLongAttr(mBeanServer, localSenderOName, "nrOfRequests"));
sender.setTotalBytes(JmxTools.getLongAttr(mBeanServer, localSenderOName, "totalBytes"));
sender.setResend(((Boolean) mBeanServer.getAttribute(localSenderOName, "resend")).booleanValue());
sender.setSuspect(((Boolean) mBeanServer.getAttribute(localSenderOName, "suspect")).booleanValue());
if (sender instanceof PooledClusterSender) {
((PooledClusterSender) sender).setMaxPoolSocketLimit(JmxTools.getIntAttr(mBeanServer, localSenderOName, "maxPoolSocketLimit"));
}
if (sender instanceof SyncClusterSender) {
SyncClusterSender syncSender = (SyncClusterSender) sender;
syncSender.setDataFailureCounter(JmxTools.getLongAttr(mBeanServer, localSenderOName, "dataFailureCounter"));
syncSender.setDataResendCounter(JmxTools.getLongAttr(mBeanServer, localSenderOName, "dataResendCounter"));
syncSender.setSocketOpenCounter(JmxTools.getIntAttr(mBeanServer, localSenderOName, "socketOpenCounter"));
syncSender.setSocketCloseCounter(JmxTools.getIntAttr(mBeanServer, localSenderOName, "socketCloseCounter"));
syncSender.setSocketOpenFailureCounter(JmxTools.getIntAttr(mBeanServer, localSenderOName, "socketOpenFailureCounter"));
}
if (sender instanceof AsyncClusterSender) {
AsyncClusterSender asyncSender = (AsyncClusterSender) sender;
asyncSender.setInQueueCounter(JmxTools.getLongAttr(mBeanServer, localSenderOName, "inQueueCounter"));
asyncSender.setOutQueueCounter(JmxTools.getLongAttr(mBeanServer, localSenderOName, "outQueueCounter"));
asyncSender.setQueueSize(JmxTools.getIntAttr(mBeanServer, localSenderOName, "queueSize"));
asyncSender.setQueuedNrOfBytes(JmxTools.getLongAttr(mBeanServer, localSenderOName, "queuedNrOfBytes"));
}
cluster.getMembers().add(sender);
}
}
}