Exemplo n.º 1
0
    @Override
    public boolean equals(Object obj) {
      MockAddress mockAddress = (MockAddress) obj;

      if (_timestamp == mockAddress.getTimestamp()) {
        return true;
      }

      return false;
    }
Exemplo n.º 2
0
    @Override
    public FutureClusterResponses execute(ClusterRequest clusterRequest) {
      List<Address> addresses = new ArrayList<Address>();

      Collection<Address> clusterNodeAddresses = clusterRequest.getTargetClusterNodeAddresses();

      if (clusterNodeAddresses != null) {
        addresses.addAll(clusterNodeAddresses);
      }

      FutureClusterResponses futureClusterResponses = new FutureClusterResponses(addresses);

      for (Address address : addresses) {
        ClusterNodeResponse clusterNodeResponse = new ClusterNodeResponse();

        clusterNodeResponse.setAddress(address);
        clusterNodeResponse.setClusterMessageType(ClusterMessageType.EXECUTE);
        clusterNodeResponse.setMulticast(clusterRequest.isMulticast());
        clusterNodeResponse.setUuid(clusterRequest.getUuid());

        MockAddress mockAddress = (MockAddress) address.getRealAddress();

        try {
          clusterNodeResponse.setClusterNode(
              new ClusterNode(
                  String.valueOf(mockAddress.getTimestamp()), InetAddress.getLocalHost()));

          clusterNodeResponse.setResult(_invoke(clusterRequest.getMethodHandler()));
        } catch (Exception e) {
        }

        futureClusterResponses.addClusterNodeResponse(clusterNodeResponse);
      }

      return futureClusterResponses;
    }