Project

General

Profile

« Previous | Next » 

Revision 10379

Added by Jing Tao over 7 years ago

Use the new manager class to get the messaging client.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
127 127
  private CNodeService(HttpServletRequest request) {
128 128
    super(request);
129 129
    logMetacat = Logger.getLogger(CNodeService.class);
130
    /*try {
131
        getIndexTaskClient();
130
    try {
131
        indexTaskClient = IndexTaskMessagingClientManager.getInstance().getMessagingClient();
132 132
    } catch (Exception e) {
133 133
        logMetacat.warn("CNodeService.constructorr - the client for sumbitting the index tasks couldn't be initialized since "+e.getMessage(), e);
134
    }*/ 
134
    }
135 135
  }
136 136
  
137
  /*
138
   * Method to get the index tasks client.
139
   */
140
  private void getIndexTaskClient() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
141
      if(indexTaskClient == null) {
142
          indexTaskClient = IndexTaskMessagingClientFactory.getClient();
143
          //System.out.println("generating the client .......................");
144
      }
145
  }
137
 
146 138
  
147 139
  /*
148 140
   * Submit a index task to the message broker.
149 141
   */
150 142
  private void submitIndexTask(SystemMetadata sysmeta, String objectURI) throws ServiceFailure, InvalidSystemMetadata, InstantiationException, IllegalAccessException, ClassNotFoundException {
151 143
      if(indexTaskClient == null) {
152
          getIndexTaskClient();
144
          indexTaskClient = IndexTaskMessagingClientManager.getInstance().getMessagingClient();
153 145
      }
154 146
      IndexTaskGenerator generator = new IndexTaskGenerator();
155 147
      IndexTask task = generator.generateAddTask(sysmeta, objectURI);

Also available in: Unified diff