Пример #1
0
 public void onMessage(Message message) {
   ObjectMessage om = (ObjectMessage) message;
   try {
     PPSOrder order = (PPSOrder) om.getObject();
     log.info("Start processing " + order);
     try {
       sendPPS(order.isCreate(), order.getDataset(), order.getDestination());
       log.info("Finished processing " + order);
     } catch (Exception e) {
       order.setThrowable(e);
       final int failureCount = order.getFailureCount() + 1;
       order.setFailureCount(failureCount);
       final long delay = retryIntervalls.getIntervall(failureCount);
       if (delay == -1L) {
         log.error("Give up to process " + order, e);
         jmsDelegate.fail(queueName, order);
       } else {
         log.warn("Failed to process " + order + ". Scheduling retry.", e);
         jmsDelegate.queue(queueName, order, 0, System.currentTimeMillis() + delay);
       }
     }
   } catch (JMSException e) {
     log.error("jms error during processing message: " + message, e);
   } catch (Throwable e) {
     log.error("unexpected error during processing message: " + message, e);
   }
 }
Пример #2
0
 protected void schedule(DeleteStudyOrder order, long scheduledTime) throws Exception {
   if (srcFsGroup == null || destFsGroup == null) {
     String msg =
         "FileMove service is disabled! Set SourceFileSystemGroupID and DestinationFileSystemGroupID to enable it.";
     log.info(msg);
     throw new RuntimeException(msg);
   } else if ("ERROR".equals(getUsableDiskSpaceStringOnDest())) {
     String msg =
         "UsableDiskSpaceStringOnDest reports an error! Scheduling Move Order cancelled! Please check DestinationFileSystemGroupID configuration!";
     log.error(msg);
     throw new RuntimeException(msg);
   } else {
     if (log.isInfoEnabled()) {
       String scheduledTimeStr = scheduledTime > 0 ? new Date(scheduledTime).toString() : "now";
       log.info(
           "Scheduling job ["
               + order
               + "] at "
               + scheduledTimeStr
               + ". Retry times: "
               + order.getFailureCount());
     }
     jmsDelegate.queue(moveFilesOfStudyQueueName, order, Message.DEFAULT_PRIORITY, scheduledTime);
   }
 }
Пример #3
0
 public void handleNotification(Notification notif, Object handback) {
   String spsuid = (String) notif.getUserData();
   Dataset pps = DcmObjectFactory.getInstance().newDataset();
   try {
     Dataset sps;
     GPWLManager gpwlmgr = getGPWLManager();
     sps = gpwlmgr.getWorklistItem(spsuid);
     String ppsiuid = spsuid + ppsuidSuffix;
     String status = sps.getString(Tags.GPSPSStatus);
     pps.putCS(Tags.GPPPSStatus, status);
     pps.putUI(Tags.SOPInstanceUID, ppsiuid);
     Date now = new Date();
     if ("IN PROGRESS".equals(status)) {
       try {
         getGPPPSManager().getGPPPS(ppsiuid);
         return; // avoid duplicate N_CREATE
       } catch (Exception e) {
       }
       pps.putSH(Tags.PPSID, "PPS" + ppsiuid.hashCode());
       pps.putDA(Tags.PPSStartDate, now);
       pps.putTM(Tags.PPSStartTime, now);
       pps.putDA(Tags.PPSEndDate);
       pps.putTM(Tags.PPSEndTime);
       for (int i = 0; i < N_CREATE_TYPE2_ATTRS.length; i++) {
         pps.putXX(N_CREATE_TYPE2_ATTRS[i]);
       }
       pps.putAll(sps.subSet(N_CREATE_SPS_ATTRS));
       copyCode(
           copyWorkitemCode,
           sps.getItem(Tags.ScheduledWorkitemCodeSeq),
           pps.putSQ(Tags.PerformedWorkitemCodeSeq));
       copyCode(
           copyStationNameCode,
           sps.getItem(Tags.ScheduledStationNameCodeSeq),
           pps.putSQ(Tags.PerformedStationNameCodeSeq));
       copyCode(
           copyStationClassCode,
           sps.getItem(Tags.ScheduledStationClassCodeSeq),
           pps.putSQ(Tags.PerformedStationClassCodeSeq));
       copyCode(
           copyStationGeographicLocationCode,
           sps.getItem(Tags.ScheduledStationGeographicLocationCodeSeq),
           pps.putSQ(Tags.PerformedStationGeographicLocationCodeSeq));
       copyCode(
           copyProcessingApplicationsCode,
           sps.getItem(Tags.ScheduledProcessingApplicationsCodeSeq),
           pps.putSQ(Tags.PerformedProcessingApplicationsCodeSeq));
     } else if ("COMPLETED".equals(status) || "DISCONTINUED".equals(status)) {
       pps.putDA(Tags.PPSEndDate, now);
       pps.putTM(Tags.PPSEndTime, now);
       pps.putAll(gpwlmgr.getOutputInformation(spsuid));
     } else {
       return;
     }
   } catch (Exception e) {
     log.error("Failed to access GP-SPS[" + spsuid + "]", e);
     return;
   }
   for (int i = 0; i < destAETs.length; i++) {
     PPSOrder order = new PPSOrder(pps, destAETs[i]);
     try {
       log.info("Scheduling " + order);
       jmsDelegate.queue(queueName, order, Message.DEFAULT_PRIORITY, 0L);
     } catch (Exception e) {
       log.error("Failed to schedule " + order, e);
     }
   }
 }
Пример #4
0
 protected void stopService() throws Exception {
   server.removeNotificationListener(
       gpwlScpServiceName, this, GPWLScpService.ON_SPS_ACTION_NOTIF_FILTER, null);
   jmsDelegate.stopListening(queueName);
 }
Пример #5
0
 protected void startService() throws Exception {
   jmsDelegate.startListening(queueName, this, concurrency);
   server.addNotificationListener(
       gpwlScpServiceName, this, GPWLScpService.ON_SPS_ACTION_NOTIF_FILTER, null);
 }
Пример #6
0
 public final void setJmsServiceName(ObjectName jmsServiceName) {
   jmsDelegate.setJmsServiceName(jmsServiceName);
 }
Пример #7
0
 public final ObjectName getJmsServiceName() {
   return jmsDelegate.getJmsServiceName();
 }
Пример #8
0
 @Override
 protected void stopService() throws Exception {
   jmsDelegate.stopListening(moveFilesOfStudyQueueName);
   super.stopService();
 }
Пример #9
0
 @Override
 protected void startService() throws Exception {
   super.startService();
   jmsDelegate.startListening(moveFilesOfStudyQueueName, this, 1);
 }