ClusterExecutorImpl implements ClusterExecutor { protected ClusterNodeResponse executeClusterRequest( ClusterRequest clusterRequest) { Serializable payload = clusterRequest.getPayload(); if (!(payload instanceof MethodHandler)) { return ClusterNodeResponse.createExceptionClusterNodeResponse( _localClusterNodeStatus.getClusterNode(), clusterRequest.getUuid(), new ClusterException( "Payload is not of type " + MethodHandler.class.getName())); } MethodHandler methodHandler = (MethodHandler)payload; ClusterInvokeThreadLocal.setEnabled(false); try { Object result = methodHandler.invoke(); if ((result instanceof Serializable) || (result == null)) { return ClusterNodeResponse.createResultClusterNodeResponse( _localClusterNodeStatus.getClusterNode(), clusterRequest.getUuid(), (Serializable)result); } return ClusterNodeResponse.createExceptionClusterNodeResponse( _localClusterNodeStatus.getClusterNode(), clusterRequest.getUuid(), new ClusterException( StringBundler.concat( methodHandler, " returned value ", result, " that is not serializable"))); } catch (Exception exception) { return ClusterNodeResponse.createExceptionClusterNodeResponse( _localClusterNodeStatus.getClusterNode(), clusterRequest.getUuid(), exception); } finally { ClusterInvokeThreadLocal.setEnabled(true); } }  @Override @Reference( cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY ) void addClusterEventListener(
		ClusterEventListener clusterEventListener); @Override FutureClusterResponses execute(ClusterRequest clusterRequest); @Override InetAddress getBindInetAddress(); @Override NetworkInterface getBindNetworkInterface(); @Override List<ClusterEventListener> getClusterEventListeners(); @Override List<ClusterNode> getClusterNodes(); @Override ClusterNode getLocalClusterNode(); @Override boolean isClusterNodeAlive(String clusterNodeId); @Override boolean isEnabled(); @Override void removeClusterEventListener(
		ClusterEventListener clusterEventListener);  }
@Test public void testExecuteClusterRequest() throws Exception { ClusterExecutorImpl clusterExecutorImpl = getClusterExecutorImpl(); ClusterNodeResponse clusterNodeResponse = clusterExecutorImpl.executeClusterRequest( ClusterRequest.createMulticastRequest(StringPool.BLANK)); Exception exception1 = clusterNodeResponse.getException(); Assert.assertEquals( "Payload is not of type " + MethodHandler.class.getName(), exception1.getMessage()); String timestamp = String.valueOf(System.currentTimeMillis()); clusterNodeResponse = clusterExecutorImpl.executeClusterRequest( ClusterRequest.createMulticastRequest( new MethodHandler( new MethodKey(TestBean.class, "testMethod3", String.class), timestamp))); try { clusterNodeResponse.getResult(); Assert.fail(); } catch (Exception exception2) { Throwable throwable = exception2.getCause(); Assert.assertEquals(timestamp, throwable.getMessage()); } timestamp = String.valueOf(System.currentTimeMillis()); clusterNodeResponse = clusterExecutorImpl.executeClusterRequest( ClusterRequest.createMulticastRequest( new MethodHandler( new MethodKey(TestBean.class, "testMethod1", String.class), timestamp))); Assert.assertEquals(timestamp, clusterNodeResponse.getResult()); Assert.assertTrue(ClusterInvokeThreadLocal.isEnabled()); clusterNodeResponse = clusterExecutorImpl.executeClusterRequest( ClusterRequest.createMulticastRequest( new MethodHandler( new MethodKey(TestBean.class, "testMethod5")))); Assert.assertFalse((Boolean)clusterNodeResponse.getResult()); Assert.assertTrue(ClusterInvokeThreadLocal.isEnabled()); }