public Object getFromCache(final String componentName, final String memberTokenId, final Serializable key) throws GMSException { if (key != null && componentName != null && memberTokenId != null) { GMSCacheable cKey = createCompositeKey(componentName, memberTokenId, key); cKey = getTrueKey(cKey); return cache.get(cKey); } else { //TODO: Localize throw new GMSException( new StringBuffer().append( "DistributedStateCache: ") .append("componentName, memberTokenId and key ") .append("are required parameters and cannot be null") .toString()); } }
public Object getFromCache(final String componentName, final String memberTokenId, final Serializable key) throws GMSException { if (key != null && componentName != null && memberTokenId != null) { GMSCacheable cKey = createCompositeKey(componentName, memberTokenId, key); cKey = getTrueKey(cKey); return cache.get(cKey); } else { //TODO: Localize throw new GMSException( new StringBuffer().append( "DistributedStateCache: ") .append("componentName, memberTokenId and key ") .append("are required parameters and cannot be null") .toString()); } }
@Override public void join() throws GMSException { viewWindowThread = isWatchdog() ? null : new Thread(viewWindow, "GMS ViewWindowThread Group-" + groupName); messageWindow = new MessageWindow(groupName, messageQueue); messageWindowThread = new Thread(messageWindow, "GMS MessageWindowThread Group-" + groupName); messageWindowThread.setDaemon(true); messageWindowThread.start(); if (viewWindowThread != null) { viewWindowThread.setDaemon(true); viewWindowThread.start(); } final Map<String, String> idMap = new HashMap<String, String>(); idMap.put(CustomTagNames.MEMBER_TYPE.toString(), memberType); idMap.put(CustomTagNames.GROUP_NAME.toString(), groupName); idMap.put(CustomTagNames.START_TIME.toString(), startTime.toString()); try { groupCommunicationProvider.initializeGroupCommunicationProvider( serverToken, groupName, idMap, configProperties); groupCommunicationProvider.join(); } catch (Throwable t) { // transport can throw IllegalStateException if not able to start up correctly. GMSException ge = new GMSException("failed to join group " + groupName, t); throw ge; } }
@Override public void join() throws GMSException { viewWindowThread = isWatchdog() ? null : new Thread(viewWindow, "GMS ViewWindowThread Group-" + groupName); messageWindow = new MessageWindow(groupName, messageQueue); messageWindowThread = new Thread(messageWindow, "GMS MessageWindowThread Group-" + groupName); messageWindowThread.setDaemon(true); messageWindowThread.start(); if (viewWindowThread != null) { viewWindowThread.setDaemon(true); viewWindowThread.start(); } final Map<String, String> idMap = new HashMap<String, String>(); idMap.put(CustomTagNames.MEMBER_TYPE.toString(), memberType); idMap.put(CustomTagNames.GROUP_NAME.toString(), groupName); idMap.put(CustomTagNames.START_TIME.toString(), startTime.toString()); try { groupCommunicationProvider.initializeGroupCommunicationProvider( serverToken, groupName, idMap, configProperties); groupCommunicationProvider.join(); } catch (Throwable t) { // transport can throw IllegalStateException if not able to start up correctly. GMSException ge = new GMSException("failed to join group " + groupName, t); throw ge; } }
public void announceWatchdogObservedFailure(String serverToken) throws GMSException { if (!isWatchdog()) { throw new GMSException("illegal state: announceWatchdogObservedFailure operation is only valid for a WATCHDOG member."); } GroupHandle gh = ctx.getGroupHandle(); ctx.getGroupCommunicationProvider().announceWatchdogObservedFailure(serverToken); }
public void announceWatchdogObservedFailure(String serverToken) throws GMSException { if (!isWatchdog()) { throw new GMSException("illegal state: announceWatchdogObservedFailure operation is only valid for a WATCHDOG member."); } GroupHandle gh = ctx.getGroupHandle(); ctx.getGroupCommunicationProvider().announceWatchdogObservedFailure(serverToken); }
/** * This returns an instance of the GroupManagementService for a given * non-null group name. * @param groupName groupName * @return GroupManagementService * @throws GMSException - if the groupName is null * * @throws GMSNotEnabledException - If GMS is not enabled * @throws GMSNotInitializedException - If GMS is not initialized */ public static GroupManagementService getGMSModule(final String groupName) throws GMSNotEnabledException, GMSException, GMSNotInitializedException { if(groupName == null){ throw new GMSException(sm.get("ex.factory.start.missing.group")); } final String key = getCompositeKey(groupName); if(groups.containsKey(key)) return groups.get(key); else if(!isGMSEnabled(groupName)){ throw new GMSNotEnabledException(sm.get("ex.factory.get.gms.is.disabled", new Object[]{groupName})); } else { throw new GMSNotInitializedException(sm.get("ex.factory.get.not.init", new Object[]{groupName})); } } /**
/** * This returns an instance of the GroupManagementService for a given * non-null group name. * @param groupName groupName * @return GroupManagementService * @throws GMSException - if the groupName is null * * @throws GMSNotEnabledException - If GMS is not enabled * @throws GMSNotInitializedException - If GMS is not initialized */ public static GroupManagementService getGMSModule(final String groupName) throws GMSNotEnabledException, GMSException, GMSNotInitializedException { if(groupName == null){ throw new GMSException(sm.get("ex.factory.start.missing.group")); } final String key = getCompositeKey(groupName); if(groups.containsKey(key)) return groups.get(key); else if(!isGMSEnabled(groupName)){ throw new GMSNotEnabledException(sm.get("ex.factory.get.gms.is.disabled", new Object[]{groupName})); } else { throw new GMSNotInitializedException(sm.get("ex.factory.get.not.init", new Object[]{groupName})); } } /**
public void sendMessage(List<String> targetServerTokens, String targetComponentName, byte[] message) throws GMSException { Throwable lastThrowable = null; String failedSendToken = null; final GMSMessage gMsg = new GMSMessage(targetComponentName, message, groupName, getGMSContext().getStartTime()); if(targetServerTokens.isEmpty()){ getGMSContext().getGroupCommunicationProvider().sendMessage(null,gMsg, true ); } else { for(String token : targetServerTokens){ try { getGMSContext().getGroupCommunicationProvider().sendMessage(token, gMsg, false ); } catch (Throwable t) { lastThrowable = t; failedSendToken = token; logger.log(Level.WARNING, "group.handle.sendmessage.failed", new Object[]{message,targetComponentName,token, t.getLocalizedMessage()}); } } } if (lastThrowable != null) { if (lastThrowable instanceof GMSException) { throw (GMSException) lastThrowable; } else { throw new GMSException("failed to send message to target server:" + failedSendToken + " target component=" + targetComponentName, lastThrowable); } } }
public void sendMessage(List<String> targetServerTokens, String targetComponentName, byte[] message) throws GMSException { Throwable lastThrowable = null; String failedSendToken = null; final GMSMessage gMsg = new GMSMessage(targetComponentName, message, groupName, getGMSContext().getStartTime()); if(targetServerTokens.isEmpty()){ getGMSContext().getGroupCommunicationProvider().sendMessage(null,gMsg, true ); } else { for(String token : targetServerTokens){ try { getGMSContext().getGroupCommunicationProvider().sendMessage(token, gMsg, false ); } catch (Throwable t) { lastThrowable = t; failedSendToken = token; logger.log(Level.WARNING, "group.handle.sendmessage.failed", new Object[]{message,targetComponentName,token, t.getLocalizedMessage()}); } } } if (lastThrowable != null) { if (lastThrowable instanceof GMSException) { throw (GMSException) lastThrowable; } else { throw new GMSException("failed to send message to target server:" + failedSendToken + " target component=" + targetComponentName, lastThrowable); } } }
throw new GMSException("message not sent", mioe); } catch (IOException ioe) { GMSException ge = new GMSException("message " + message + " not sent to group, send returned false"); monitorDoSend(gmsMessage, duration, false, ge); } else { 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);
/** * Sends a message to all members of the Group. Expects a byte array as * parameter carrying the payload. * * @param componentName Destination component in remote members. * @param message Payload in byte array to be delivered to the destination. */ public void sendMessage(final String componentName, final byte[] message) throws GMSException { try { final GMSMessage gMsg = new GMSMessage(componentName, message, groupName, getGMSContext().getStartTime()); getGMSContext().getGroupCommunicationProvider().sendMessage(null, gMsg, true); } catch (Throwable t) { if (t instanceof GMSException) { throw (GMSException)t; } else { throw new GMSException("failed to brodcast message to group " + groupName + " to target component:" + componentName, t); } } }
netManager.start(); } catch (IOException ioe) { throw new GMSException("initialization failure", ioe); } catch (IllegalStateException ise) { throw new GMSException("initialization failure", ise);
/** * Sends a message to all members of the Group. Expects a byte array as * parameter carrying the payload. * * @param componentName Destination component in remote members. * @param message Payload in byte array to be delivered to the destination. */ public void sendMessage(final String componentName, final byte[] message) throws GMSException { try { final GMSMessage gMsg = new GMSMessage(componentName, message, groupName, getGMSContext().getStartTime()); getGMSContext().getGroupCommunicationProvider().sendMessage(null, gMsg, true); } catch (Throwable t) { if (t instanceof GMSException) { throw (GMSException)t; } else { throw new GMSException("failed to brodcast message to group " + groupName + " to target component:" + componentName, t); } } }
/** * Sends a message to a single member of the group * Expects a targetServerToken representing the recipient member's * id, the target component name in the target recipient member, * and a byte array as parameter carrying the payload. Specifying * a null component name would result in the message being * delivered to all registered components in the target member * instance. * * @param targetServerToken destination member's identification * @param targetComponentName destination member's target component * @param message Payload in byte array to be delivered to the destination. */ public void sendMessage(final String targetServerToken, final String targetComponentName, final byte[] message) throws GMSException { try { final GMSMessage gMsg = new GMSMessage(targetComponentName, message, groupName, getGMSContext().getStartTime()); getGMSContext().getGroupCommunicationProvider().sendMessage(targetServerToken, gMsg, false); } catch (Throwable t) { if (t instanceof GMSException) { throw (GMSException)t; } else { throw new GMSException("failed to send message to target server:" + targetServerToken + " target component:" + targetComponentName, t); } } }
/** * Sends a message to a single member of the group * Expects a targetServerToken representing the recipient member's * id, the target component name in the target recipient member, * and a byte array as parameter carrying the payload. Specifying * a null component name would result in the message being * delivered to all registered components in the target member * instance. * * @param targetServerToken destination member's identification * @param targetComponentName destination member's target component * @param message Payload in byte array to be delivered to the destination. */ public void sendMessage(final String targetServerToken, final String targetComponentName, final byte[] message) throws GMSException { try { final GMSMessage gMsg = new GMSMessage(targetComponentName, message, groupName, getGMSContext().getStartTime()); getGMSContext().getGroupCommunicationProvider().sendMessage(targetServerToken, gMsg, false); } catch (Throwable t) { if (t instanceof GMSException) { throw (GMSException)t; } else { throw new GMSException("failed to send message to target server:" + targetServerToken + " target component:" + targetComponentName, t); } } }
netManager.start(); } catch (IOException ioe) { throw new GMSException("initialization failure", ioe); } catch (IllegalStateException ise) { throw new GMSException("initialization failure", ise);
new Object[] {instanceName, clusterName}); } else throw new GMSException("gms object is null.");
throw new GMSException ("Could not raise fence. Fence for member "+failedMemberToken +" and Component "+ componentName+" already exists");
throw new GMSException ("Could not raise fence. Fence for member "+failedMemberToken +" and Component "+ componentName+" already exists");