public void remove(Object key) { Object[] args = {key}; try { partition.callMethodOnCluster(cacheName, "_remove", args, REMOVE_TYPES, false); } catch (Exception ex) { throw new RuntimeException(ex); } }
public void flush(Object key) { Object[] args = {}; try { partition.callMethodOnCluster(cacheName, "_flush", args, null, false); } catch (Exception ex) { throw new RuntimeException(ex); } }
protected void pullState() throws Exception { Object[] args = {}; List rsp = partition.callMethodOnCluster(cacheName, "getCurrentState", args, null, true); if (rsp.size() > 0) { setCurrentState((Serializable)rsp.get(0)); } }
public void removeSession(String appName, Object keyId) { if (this.getAppMap(appName).remove(keyId) != null) { Object[] args = { appName, keyId }; try { this.partition.callMethodOnCluster(this.sessionStateIdentifier, "_removeSession", args, REMOVE_SESSION_TYPES, true); } catch (Exception e) { this.log.error("operation failed", e); } } }
public void sendNewObjects(List newObjects) throws Exception { log.trace("sending new objects"); try { Object[] args = {newObjects}; checkResponses(partition.callMethodOnCluster(domainName, "addNewObjects", args, LIST_TYPE, true)); } catch (Exception ex) { log.error("serious cache problems, data inconsistency is imminent", ex); throw ex; } }
public void run() { try { haPartition.callMethodOnCluster(getServiceHAName(), "pushDiscrepancyMap", new Object[] { arg }, PUSH_DISCREPANCY_MAP_TYPES, true); } catch (Exception e) { log.error("Exception pushing Discrepancy map to cluster", e); } } };
protected void _do_rpc_invalidates(String invalidationGroupName, Serializable[] keys, boolean asynch) { Object[] params = new Object[] { invalidationGroupName, keys }; try { if (asynch) { this.partition.callAsynchMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_invalidates", params, rpc_invalidates_types, true); } else { this.partition.callMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_invalidates", params, rpc_invalidates_types, true); } } catch (Exception e) { this.log.debug("Distributed invalidation (2) has failed for group " + invalidationGroupName + " (Bridge: " + this.bridgeName + ")"); } }
protected void pullState() throws Exception { List<Serializable> rsp = partition.callMethodOnCluster(domainName, "getCurrentState", NULL_ARGS, NULL_TYPES, Serializable.class, true, null, partition.getMethodCallTimeout(), false); if (rsp.size() > 0) setCurrentState(rsp.get(0)); }
protected void _do_rpc_batchInvalidate(BatchInvalidation[] invalidations, boolean asynch) { Object[] params = new Object[] { invalidations }; try { if (asynch) { this.partition.callAsynchMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_batchInvalidate", params, rpc_batch_invalidate_types, true); } else { this.partition.callMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_batchInvalidate", params, rpc_batch_invalidate_types, true); } } catch (Exception e) { this.log.debug("Distributed invalidation (3) has failed (Bridge: " + this.bridgeName + ")"); } }
protected void _do_rpc_invalidate(String invalidationGroupName, Serializable key, boolean asynch) { Object[] params = new Object[] { invalidationGroupName, key }; try { if (asynch) { this.partition.callAsynchMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_invalidate", params, rpc_invalidate_types, true); } else { this.partition.callMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_invalidate", params, rpc_invalidate_types, true); } } catch (Exception e) { this.log.debug("Distributed invalidation (1) has failed for group " + invalidationGroupName + " (Bridge: " + this.bridgeName + ")"); } }
protected void _do_rpc_invalidate_all(String invalidationGroupName, boolean asynch) { Object[] params = new Object[] { invalidationGroupName }; try { if (asynch) { this.partition.callAsynchMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_invalidate_all", params, rpc_invalidate_all_types, true); } else { this.partition.callMethodOnCluster(this.RPC_HANDLER_NAME, "_rpc_invalidate_all", params, rpc_invalidate_all_types, true); } } catch (Exception e) { this.log.debug("Distributed invalidation (2) has failed for group " + invalidationGroupName + " (Bridge: " + this.bridgeName + ")"); } }
protected void sendClusterUpdatesAndRelease(GUID globalTxId, List clusterUpdates) throws Exception { try { Object[] args = {partition.getNodeName(), globalTxId, clusterUpdates}; checkResponses(partition.callMethodOnCluster(domainName, "updateObjects", args, LOCK_TYPES, true)); } catch (Exception ex) { log.error("serious cache problems, data inconsistency is imminent", ex); throw ex; } } protected void acquireRemoteLocks(GUID globalTxId, List guids) throws Exception
@SuppressWarnings("unchecked") protected List callMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception { return this.getHAPartition().callMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true); }
protected void acquireRemoteLocks(GUID globalTxId, List guids) throws Exception { try { Object[] args = {partition.getNodeName(), globalTxId, guids}; checkResponses(partition.callMethodOnCluster(domainName, "acquireLocks", args, LOCK_TYPES, true)); } catch (Exception ex) { try { Object[] args = {partition.getNodeName()}; partition.callMethodOnCluster(domainName, "releaseHeldLocks", args, STRING_TYPE, true); } catch (Exception ignored) { } throw ex; } }
@Override public void add(String key, Serializable replicant) throws Exception { if (this.log.isTraceEnabled()) { this.log.trace("add, key=" + key + ", value=" + replicant); } Object[] args = { key, this.partition.getNodeName(), replicant }; this.partition.callMethodOnCluster(SERVICE_NAME, "_add", args, add_types, true); List<Serializable> replicants = null; synchronized (this.localReplicants) { this.localReplicants.put(key, replicant); replicants = this.getReplicants(key); } this.notifyKeyListeners(key, replicants, false); }
public void insert(Object key, Object obj) throws Exception { try { obj = versionManager.makeVersioned(obj); if (versionManager.isVersioned(obj)) { log.trace("Inserting versioned object"); obj = VersionManager.getGUID((InstanceAdvised)obj); } else { log.trace("Inserting a non-Versioned object"); } Object[] args = {key, obj}; partition.callMethodOnCluster(cacheName, "_insert", args, INSERT_TYPES, false); } catch (Exception ex) { ex.printStackTrace(); throw ex; } }
this.partition.callMethodOnCluster(this.sessionStateIdentifier, "_setState", args, SET_STATE_TYPES, true);
/** * @see org.jboss.modcluster.ha.rpc.ResetRequestSourceRpcHandler#getResetRequests() */ @SuppressWarnings("unchecked") public List<RpcResponse<List<MCMPRequest>>> getResetRequests(Map<String, Set<ResetRequestSource.VirtualHost>> response) { try { return (List<RpcResponse<List<MCMPRequest>>>) this.serviceKeyProvider.getHAPartition().callMethodOnCluster(this.serviceKeyProvider.getHAServiceKey(), METHOD_NAME, new Object[] { response }, TYPES, true); } catch (Exception e) { //FIXME what to do? throw Utils.convertToUnchecked(e); } } }
@SuppressWarnings("unchecked") private <T> RpcResponse<T> invokeRpc(String methodName, Object[] args, Class<?>[] types) throws Exception List<?> responses = ClusteredMCMPHandlerImpl.this.serviceKeyProvider.getHAPartition().callMethodOnCluster(ClusteredMCMPHandlerImpl.this.serviceKeyProvider.getHAServiceKey(), methodName, args, types, false, new RpcResponseFilter());
private void executeRemoteAction(SynchronizationId<?> id, SynchronizationRemoteAction<?> action) throws Exception { Object[] args = new Object[]{ id, action.getRepositoryContentModification().getItem(), action.isInitiation()}; List<?> rsps = null; try { rsps = this.partition.callMethodOnCluster(getServiceHAName(), "executeModification", args, EXECUTE_MOD_TYPES, true); } catch (Exception e) { action.cancel(); throw e; } action.complete(); // We sent the command, so it is complete even if we fail below for (Object rsp : rsps) { if (rsp instanceof NotSynchronizedException) { continue; } else if (rsp instanceof Throwable) { rethrowAsException((Throwable) rsp); } } }