private ArrayBlockingQueue<MessagePacket> getMsgQueue() { if (msgQueue == null) { msgQueue = getGMSContext().getMessageQueue(); } return msgQueue; }
public void sendMessage(Serializable message) throws GMSException, MemberNotInViewException { sendMessage(null, message, false); }
final String member = currentMemberAdv.getName(); final long INDOUBT_INTERVAL_MS = clusterManager.getHealthMonitor().getIndoubtDuration(); MemberStates memberState = getMemberState(member, INDOUBT_INTERVAL_MS, 0); if (memberState == MemberStates.PEERSTOPPING || monitorDoSend(gmsMessage, duration, true, null); } else { if (!sent) { GMSException ge = new GMSException("message " + message + " not sent to group, send returned false"); monitorDoSend(gmsMessage, duration, false, ge); } else { monitorDoSend(gmsMessage, duration, true, null); duration = System.currentTimeMillis() - startTime; if (sent) { monitorDoSend(gmsMessage, duration, sent, null); } else { GMSException ge = new GMSException("message " + message + " not sent to " + id + ", send returned false"); monitorDoSend(gmsMessage, duration, sent, ge); throw ge; logSendMessageException("sendMessage msg:" + theMsgOutput + " duration(ms):" + duration + " failed with handled IOException", e); monitorDoSend(gmsMessage, duration, false, e); throw new GMSException(e);
public void handleClusterMessage(final SystemAdvertisement adv, final Object message) { MessagePacket msgPkt = new MessagePacket(adv, message); try { //logger.log(Level.FINE, "Received AppMessage Notification, placing in message queue = " + new String(((GMSMessage)message).getMessage())); boolean result = getMsgQueue().offer(msgPkt); if (result == false) { // blocking queue is full. log how long we were blocked. int fullcapacity = getMsgQueue().size(); long starttime = System.currentTimeMillis(); try { getMsgQueue().put(msgPkt); } finally { long duration = System.currentTimeMillis() - starttime; if (duration > 0) { monitorLogger.info("remote message reception blocked due to incoming message queue being full for " + duration + " ms. Message queue capacity: " + fullcapacity); } } } } catch (InterruptedException e) { logger.log(Level.WARNING, MessageFormat.format("Interrupted Exception occured while adding message to Shoal MessageQueue :{0}", e.getLocalizedMessage())); } }
new GroupCommunicationProviderImpl(groupName);
final String member = currentMemberAdv.getName(); final long INDOUBT_INTERVAL_MS = clusterManager.getHealthMonitor().getIndoubtDuration(); MemberStates memberState = getMemberState(member, INDOUBT_INTERVAL_MS, 0); if (memberState == MemberStates.PEERSTOPPING || monitorDoSend(gmsMessage, duration, true, null); } else { if (!sent) { GMSException ge = new GMSException("message " + message + " not sent to group, send returned false"); monitorDoSend(gmsMessage, duration, false, ge); } else { monitorDoSend(gmsMessage, duration, true, null); duration = System.currentTimeMillis() - startTime; if (sent) { monitorDoSend(gmsMessage, duration, sent, null); } else { GMSException ge = new GMSException("message " + message + " not sent to " + id + ", send returned false"); monitorDoSend(gmsMessage, duration, sent, ge); throw ge; logSendMessageException("sendMessage msg:" + theMsgOutput + " duration(ms):" + duration + " failed with handled IOException", e); monitorDoSend(gmsMessage, duration, false, e); throw new GMSException(e);
public void handleClusterMessage(final SystemAdvertisement adv, final Object message) { MessagePacket msgPkt = new MessagePacket(adv, message); try { //logger.log(Level.FINE, "Received AppMessage Notification, placing in message queue = " + new String(((GMSMessage)message).getMessage())); boolean result = getMsgQueue().offer(msgPkt); if (result == false) { // blocking queue is full. log how long we were blocked. int fullcapacity = getMsgQueue().size(); long starttime = System.currentTimeMillis(); try { getMsgQueue().put(msgPkt); } finally { long duration = System.currentTimeMillis() - starttime; if (duration > 0) { monitorLogger.info("remote message reception blocked due to incoming message queue being full for " + duration + " ms. Message queue capacity: " + fullcapacity); } } } } catch (InterruptedException e) { logger.log(Level.WARNING, MessageFormat.format("Interrupted Exception occured while adding message to Shoal MessageQueue :{0}", e.getLocalizedMessage())); } }
private ArrayBlockingQueue<MessagePacket> getMsgQueue() { if (msgQueue == null) { msgQueue = getGMSContext().getMessageQueue(); } return msgQueue; }
public void sendMessage(Serializable message) throws GMSException, MemberNotInViewException { sendMessage(null, message, false); }
final List<ClusterViewEventListener> cvListeners = new ArrayList<ClusterViewEventListener>(); if (! getGMSContext().isWatchdog()) {
void syncCache(final PeerID peerID, final boolean isCoordinator) throws GMSException { final ConcurrentHashMap<GMSCacheable, Object> temp; temp = new ConcurrentHashMap<GMSCacheable, Object>(cache); final DSCMessage msg = new DSCMessage(temp, DSCMessage.OPERATION.ADDALLLOCAL.toString(), isCoordinator); if (!peerID.getInstanceName().equals(getGMSContext().getServerIdentityToken())) { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Sending sync message from DistributedStateCache to member " + peerID); } boolean result = ((GroupCommunicationProviderImpl)this.ctxRef.get().getGroupCommunicationProvider()).sendMessage(peerID, msg); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "synch cache sent result:" + result + " with member:" + peerID.getInstanceName() + " id:" + peerID); } } if (isCoordinator) { indicateFirstSyncDone(); } }
final List<ClusterViewEventListener> cvListeners = new ArrayList<ClusterViewEventListener>(); if (! getGMSContext().isWatchdog()) {
void syncCache(final PeerID peerID, final boolean isCoordinator) throws GMSException { final ConcurrentHashMap<GMSCacheable, Object> temp; temp = new ConcurrentHashMap<GMSCacheable, Object>(cache); final DSCMessage msg = new DSCMessage(temp, DSCMessage.OPERATION.ADDALLLOCAL.toString(), isCoordinator); if (!peerID.getInstanceName().equals(getGMSContext().getServerIdentityToken())) { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Sending sync message from DistributedStateCache to member " + peerID); } boolean result = ((GroupCommunicationProviderImpl)this.ctxRef.get().getGroupCommunicationProvider()).sendMessage(peerID, msg); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "synch cache sent result:" + result + " with member:" + peerID.getInstanceName() + " id:" + peerID); } } if (isCoordinator) { indicateFirstSyncDone(); } }
public void clusterViewEvent(final ClusterViewEvent clusterViewEvent, final ClusterView clusterView) { if (!getGMSContext().isShuttingDown()) { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Received Cluster View Event..." + clusterViewEvent.getEvent().toString() + clusterViewEvent.getAdvertisement(), clusterView); final ArrayBlockingQueue<EventPacket> viewQueue = getGMSContext().getViewQueue(); try { final int remainingCapacity = viewQueue.remainingCapacity();
public void clusterViewEvent(final ClusterViewEvent clusterViewEvent, final ClusterView clusterView) { if (!getGMSContext().isShuttingDown()) { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Received Cluster View Event..." + clusterViewEvent.getEvent().toString() + clusterViewEvent.getAdvertisement(), clusterView); final ArrayBlockingQueue<EventPacket> viewQueue = getGMSContext().getViewQueue(); try { final int remainingCapacity = viewQueue.remainingCapacity();