You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Yiqun Lin (Jira)" <ji...@apache.org> on 2020/01/22 14:28:00 UTC

[jira] [Created] (HDDS-2927) Cache EndPoint tasks instead of creating them all the time

Yiqun Lin created HDDS-2927:
-------------------------------

             Summary: Cache EndPoint tasks instead of creating them all the time
                 Key: HDDS-2927
                 URL: https://issues.apache.org/jira/browse/HDDS-2927
             Project: Hadoop Distributed Data Store
          Issue Type: Improvement
            Reporter: Yiqun Lin
            Assignee: Yiqun Lin


Currently, we create EndPoint tasks all the time. This is an inefficient way, we could cache these task as TODO comment suggested.

{code}
  //TODO : Cache some of these tasks instead of creating them
  //all the time.
  private Callable<EndpointStateMachine.EndPointStates>
      getEndPointTask(EndpointStateMachine endpoint) {
    switch (endpoint.getState()) {
    case GETVERSION:
      return new VersionEndpointTask(endpoint, conf, context.getParent()
          .getContainer());
    case REGISTER:
      return  RegisterEndpointTask.newBuilder()
          .setConfig(conf)
          .setEndpointStateMachine(endpoint)
          .setContext(context)
          .setDatanodeDetails(context.getParent().getDatanodeDetails())
          .setOzoneContainer(context.getParent().getContainer())
          .build();
    case HEARTBEAT:
      return HeartbeatEndpointTask.newBuilder()
          .setConfig(conf)
          .setEndpointStateMachine(endpoint)
          .setDatanodeDetails(context.getParent().getDatanodeDetails())
          .setContext(context)
          .build();
    case SHUTDOWN:
      break;
    default:
      throw new IllegalArgumentException("Illegal Argument.");
     }
    return null;
   }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org