List of usage examples for java.util.concurrent Executors newSingleThreadScheduledExecutor
public static ScheduledExecutorService newSingleThreadScheduledExecutor()
From source file:org.dcm4che.tool.ihe.modality.Modality.java
@SuppressWarnings({ "unchecked" }) public static void main(String[] args) { try {/* ww w. j a v a2 s . c om*/ CommandLine cl = parseComandLine(args); if (cl.getArgList().isEmpty()) throw new MissingOptionException(rb.getString("missing-i-file")); final Device device = new Device("modality"); final Connection conn = new Connection(); final ApplicationEntity ae = new ApplicationEntity("MODALITY"); checkOptions(cl); CLIUtils.configureBind(conn, ae, cl); CLIUtils.configure(conn, cl); device.addConnection(conn); device.addApplicationEntity(ae); ae.addConnection(conn); final MppsSCU mppsscu = new MppsSCU(ae); final StoreSCU storescu = new StoreSCU(ae); final StgCmtSCU stgcmtscu = new StgCmtSCU(ae); CLIUtils.configureConnect(mppsscu.getRemoteConnection(), mppsscu.getAAssociateRQ(), cl); CLIUtils.configureConnect(stgcmtscu.getRemoteConnection(), stgcmtscu.getAAssociateRQ(), cl); CLIUtils.configureConnect(storescu.getRemoteConnection(), storescu.getAAssociateRQ(), cl); calledAET = storescu.getAAssociateRQ().getCalledAET(); mppsscu.setTransferSyntaxes(CLIUtils.transferSyntaxesOf(cl)); mppsscu.setCodes( CLIUtils.loadProperties(cl.getOptionValue("code-config", "resource:code.properties"), null)); if (cl.hasOption("dc")) mppsscu.setFinalStatus("DISCONTINUED"); if (cl.hasOption("dc-reason")) mppsscu.setDiscontinuationReason(cl.getOptionValue("dc-reason")); stgcmtscu.setTransferSyntaxes(CLIUtils.transferSyntaxesOf(cl)); stgcmtscu.setStorageDirectory(StgCmtSCU.getStorageDirectory(cl)); StoreSCU.configureRelatedSOPClass(storescu, cl); storescu.setUIDSuffix(StoreSCU.uidSuffixOf(cl)); Attributes attrs = new Attributes(); CLIUtils.addAttributes(attrs, cl.getOptionValues("s")); mppsscu.setAttributes(attrs); storescu.setAttributes(attrs); stgcmtscu.setAttributes(attrs); setTlsParams(mppsscu.getRemoteConnection(), conn); setTlsParams(storescu.getRemoteConnection(), conn); setTlsParams(stgcmtscu.getRemoteConnection(), conn); String tmpPrefix = "iocmtest-"; String tmpSuffix = null; File tmpDir = null; configureTmpFile(storescu, tmpPrefix, tmpSuffix, tmpDir, cl); String mppsiuid = UIDUtils.createUID(); mppsscu.setPPSUID(mppsiuid); if (cl.hasOption("kos-title")) { List<String> fname = Arrays.asList(mkkos(cl)); scanFiles(fname, tmpPrefix, tmpSuffix, tmpDir, mppsscu, storescu, stgcmtscu); } else { stgcmtscu.setUIDSuffix(cl.getOptionValue("uid-suffix")); storescu.setUIDSuffix(cl.getOptionValue("uid-suffix")); mppsscu.setUIDSuffix(cl.getOptionValue("uid-suffix")); scanFiles(cl.getArgList(), tmpPrefix, tmpSuffix, tmpDir, mppsscu, storescu, stgcmtscu); } ExecutorService executorService = Executors.newCachedThreadPool(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); device.setExecutor(executorService); device.setScheduledExecutor(scheduledExecutorService); device.bindConnections(); try { boolean sendMpps = cl.hasOption("mpps"); boolean sendLateMpps = cl.hasOption("mpps-late"); if (sendMpps || sendLateMpps) sendMpps(mppsscu, sendMpps); addReferencedPerformedProcedureStepSequence(mppsiuid, storescu); sendObjects(storescu); if (sendLateMpps) sendMppsNSet(mppsscu); if (cl.hasOption("stgcmt")) sendStgCmt(stgcmtscu); } finally { if (conn.isListening()) { device.waitForNoOpenConnections(); device.unbindConnections(); } executorService.shutdown(); scheduledExecutorService.shutdown(); } } catch (ParseException e) { System.err.println(e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:org.dcm4che3.tool.ihe.modality.Modality.java
@SuppressWarnings({ "unchecked" }) public static void main(String[] args) { try {/* www . j a v a 2 s . c om*/ CommandLine cl = parseComandLine(args); if (cl.getArgList().isEmpty()) throw new MissingOptionException(rb.getString("missing-i-file")); final Device device = new Device("modality"); final Connection conn = new Connection(); final ApplicationEntity ae = new ApplicationEntity("MODALITY"); checkOptions(cl); CLIUtils.configureBind(conn, ae, cl); CLIUtils.configure(conn, cl); device.addConnection(conn); device.addApplicationEntity(ae); ae.addConnection(conn); final MppsSCU mppsscu = new MppsSCU(ae); final StoreSCU storescu = new StoreSCU(ae); final StgCmtSCU stgcmtscu = new StgCmtSCU(ae); CLIUtils.configureConnect(mppsscu.getRemoteConnection(), mppsscu.getAAssociateRQ(), cl); CLIUtils.configureConnect(stgcmtscu.getRemoteConnection(), stgcmtscu.getAAssociateRQ(), cl); CLIUtils.configureConnect(storescu.getRemoteConnection(), storescu.getAAssociateRQ(), cl); calledAET = storescu.getAAssociateRQ().getCalledAET(); mppsscu.setTransferSyntaxes(CLIUtils.transferSyntaxesOf(cl)); mppsscu.setCodes( CLIUtils.loadProperties(cl.getOptionValue("code-config", "resource:code.properties"), null)); if (cl.hasOption("dc")) mppsscu.setFinalStatus("DISCONTINUED"); if (cl.hasOption("dc-reason")) mppsscu.setDiscontinuationReason(cl.getOptionValue("dc-reason")); stgcmtscu.setTransferSyntaxes(CLIUtils.transferSyntaxesOf(cl)); stgcmtscu.setStorageDirectory(StgCmtSCU.getStorageDirectory(cl)); StoreSCU.configureRelatedSOPClass(storescu, cl); storescu.setUIDSuffix(StoreSCU.uidSuffixOf(cl)); Attributes attrs = new Attributes(); CLIUtils.addAttributes(attrs, cl.getOptionValues("s")); mppsscu.setAttributes(attrs); storescu.setAttributes(attrs); stgcmtscu.setAttributes(attrs); setTlsParams(mppsscu.getRemoteConnection(), conn); setTlsParams(storescu.getRemoteConnection(), conn); setTlsParams(stgcmtscu.getRemoteConnection(), conn); String tmpPrefix = "iocmtest-"; String tmpSuffix = null; File tmpDir = null; configureTmpFile(storescu, tmpPrefix, tmpSuffix, tmpDir, cl); String mppsiuid = UIDUtils.createUID(); mppsscu.setPPSUID(mppsiuid); if (cl.hasOption("kos-title")) { List<String> fname = Arrays.asList(mkkos(cl)); scanFiles(fname, tmpPrefix, tmpSuffix, tmpDir, mppsscu, storescu, stgcmtscu); } else { stgcmtscu.setUIDSuffix(cl.getOptionValue("uid-suffix")); storescu.setUIDSuffix(cl.getOptionValue("uid-suffix")); mppsscu.setUIDSuffix(cl.getOptionValue("uid-suffix")); scanFiles(cl.getArgList(), tmpPrefix, tmpSuffix, tmpDir, mppsscu, storescu, stgcmtscu); } ExecutorService executorService = Executors.newCachedThreadPool(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); device.setExecutor(executorService); device.setScheduledExecutor(scheduledExecutorService); device.bindConnections(); try { boolean sendMpps = cl.hasOption("mpps"); boolean sendLateMpps = cl.hasOption("mpps-late"); if (sendMpps || sendLateMpps) { sendMpps(mppsscu, sendMpps); addReferencedPerformedProcedureStepSequence(mppsiuid, storescu); } else { nullifyReferencedPerformedProcedureStepSequence(storescu); } sendObjects(storescu); if (sendLateMpps) sendMppsNSet(mppsscu); if (cl.hasOption("stgcmt")) sendStgCmt(stgcmtscu); } finally { if (conn.isListening()) { device.waitForNoOpenConnections(); device.unbindConnections(); } executorService.shutdown(); scheduledExecutorService.shutdown(); } } catch (ParseException e) { System.err.println(e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:org.dcm4che.tool.hl7rcv.HL7Rcv.java
public static void main(String[] args) { try {/*from ww w . j av a 2 s . c om*/ CommandLine cl = parseComandLine(args); HL7Rcv main = new HL7Rcv(); configure(main, cl); ExecutorService executorService = Executors.newCachedThreadPool(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); main.device.setScheduledExecutor(scheduledExecutorService); main.device.setExecutor(executorService); main.device.bindConnections(); } catch (ParseException e) { System.err.println("hl7rcv: " + e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println("hl7rcv: " + e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:com.amazonaws.services.iot.demo.danbo.rpi.Danbo.java
public static void main(String[] args) throws Exception { log.debug("starting"); // uses pin 6 for the red Led final Led redLed = new Led(6); // uses pin 26 for the green Led final Led greenLed = new Led(26); // turns the red led on initially redLed.on();//ww w . jav a2 s .c o m // turns the green led off initially greenLed.off(); // loads properties from danbo.properties file - make sure this file is // available on the pi's home directory InputStream input = new FileInputStream("/home/pi/danbo/danbo.properties"); Properties properties = new Properties(); properties.load(input); endpoint = properties.getProperty("awsiot.endpoint"); rootCA = properties.getProperty("awsiot.rootCA"); privateKey = properties.getProperty("awsiot.privateKey"); certificate = properties.getProperty("awsiot.certificate"); url = protocol + endpoint + ":" + port; log.debug("properties loaded"); // turns off both eyes RGBLed rgbLed = new RGBLed("RGBLed1", Danbo.pinLayout1, Danbo.pinLayout2, new Color(0, 0, 0), new Color(0, 0, 0), 0, 100); new Thread(rgbLed).start(); // resets servo to initial positon Servo servo = new Servo("Servo", 1); new Thread(servo).start(); // gets the Pi serial number and uses it as part of the thing // registration name clientId = clientId + getSerialNumber(); // AWS IoT things shadow topics updateTopic = "$aws/things/" + clientId + "/shadow/update"; deltaTopic = "$aws/things/" + clientId + "/shadow/update/delta"; rejectedTopic = "$aws/things/" + clientId + "/shadow/update/rejected"; // AWS IoT controller things shadow topic (used to register new things) controllerUpdateTopic = "$aws/things/Controller/shadow/update"; // defines an empty danbo shadow POJO final DanboShadow danboShadow = new DanboShadow(); DanboShadow.State state = danboShadow.new State(); final DanboShadow.State.Reported reported = state.new Reported(); reported.setEyes("readyToBlink"); reported.setHead("readyToMove"); reported.setMouth("readyToSing"); reported.setName(clientId); state.setReported(reported); danboShadow.setState(state); // defines an empty controller shadow POJO final ControllerShadow controllerShadow = new ControllerShadow(); ControllerShadow.State controllerState = controllerShadow.new State(); final ControllerShadow.State.Reported controllerReported = controllerState.new Reported(); controllerReported.setThingName(clientId); controllerState.setReported(controllerReported); controllerShadow.setState(controllerState); try { log.debug("registering"); // registers the thing (creates a new thing) by updating the // controller String message = gson.toJson(controllerShadow); MQTTPublisher controllerUpdatePublisher = new MQTTPublisher(controllerUpdateTopic, qos, message, url, clientId + "-controllerupdate" + rand.nextInt(100000), cleanSession, rootCA, privateKey, certificate); new Thread(controllerUpdatePublisher).start(); log.debug("registered"); // clears the thing status (in case the thing already existed) Danbo.deleteStatus("initialDelete"); // creates an MQTT subscriber to the things shadow delta topic // (command execution notification) MQTTSubscriber deltaSubscriber = new MQTTSubscriber(new DanboShadowDeltaCallback(), deltaTopic, qos, url, clientId + "-delta" + rand.nextInt(100000), cleanSession, rootCA, privateKey, certificate); new Thread(deltaSubscriber).start(); // creates an MQTT subscriber to the things shadow error topic MQTTSubscriber errorSubscriber = new MQTTSubscriber(new DanboShadowRejectedCallback(), rejectedTopic, qos, url, clientId + "-rejected" + rand.nextInt(100000), cleanSession, rootCA, privateKey, certificate); new Thread(errorSubscriber).start(); // turns the red LED off redLed.off(); ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); exec.scheduleAtFixedRate(new Runnable() { @Override public void run() { // turns the green LED on greenLed.on(); log.debug("running publish state thread"); int temp = -300; int humid = -300; reported.setTemperature(new Integer(temp).toString()); reported.setHumidity(new Integer(humid).toString()); try { // reads the temperature and humidity data Set<Sensor> sensors = Sensors.getSensors(); log.debug(sensors.size()); for (Sensor sensor : sensors) { log.debug(sensor.getPhysicalQuantity()); log.debug(sensor.getValue()); if (sensor.getPhysicalQuantity().toString().equals("Temperature")) { temp = sensor.getValue().intValue(); } if (sensor.getPhysicalQuantity().toString().equals("Humidity")) { humid = sensor.getValue().intValue(); } } log.debug("temperature: " + temp); log.debug("humidity: " + humid); reported.setTemperature(new Integer(temp).toString()); reported.setHumidity(new Integer(humid).toString()); } catch (Exception e) { log.error("an error has ocurred: " + e.getMessage()); e.printStackTrace(); } try { // reports current state - last temperature and humidity // read String message = gson.toJson(danboShadow); MQTTPublisher updatePublisher = new MQTTPublisher(updateTopic, qos, message, url, clientId + "-update" + rand.nextInt(100000), cleanSession, rootCA, privateKey, certificate); new Thread(updatePublisher).start(); } catch (Exception e) { log.error("an error has ocurred: " + e.getMessage()); e.printStackTrace(); } // turns the green LED off greenLed.off(); } }, 0, 5, TimeUnit.SECONDS); // runs this thread every 5 seconds, // with an initial delay of 5 seconds } catch (MqttException me) { // Display full details of any exception that occurs log.error("reason " + me.getReasonCode()); log.error("msg " + me.getMessage()); log.error("loc " + me.getLocalizedMessage()); log.error("cause " + me.getCause()); log.error("excep " + me); me.printStackTrace(); } catch (Throwable th) { log.error("msg " + th.getMessage()); log.error("loc " + th.getLocalizedMessage()); log.error("cause " + th.getCause()); log.error("excep " + th); th.printStackTrace(); } }
From source file:com.opengamma.batch.BatchJobRunner.java
/** * Creates an runs a batch job based on a properties file and configuration. *//*from w ww. j a v a 2 s.co m*/ public static void main(String[] args) throws Exception { // CSIGNORE if (args.length == 0) { usage(); System.exit(-1); } CommandLine line = null; Properties configProperties = null; final String propertyFile = "batchJob.properties"; String configPropertyFile = null; if (System.getProperty(propertyFile) != null) { configPropertyFile = System.getProperty(propertyFile); try { FileInputStream fis = new FileInputStream(configPropertyFile); configProperties = new Properties(); configProperties.load(fis); fis.close(); } catch (FileNotFoundException e) { s_logger.error("The system cannot find " + configPropertyFile); System.exit(-1); } } else { try { FileInputStream fis = new FileInputStream(propertyFile); configProperties = new Properties(); configProperties.load(fis); fis.close(); configPropertyFile = propertyFile; } catch (FileNotFoundException e) { // there is no config file so we expect command line arguments try { CommandLineParser parser = new PosixParser(); line = parser.parse(getOptions(), args); } catch (ParseException e2) { usage(); System.exit(-1); } } } RunCreationMode runCreationMode = getRunCreationMode(line, configProperties, configPropertyFile); if (runCreationMode == null) { // default runCreationMode = RunCreationMode.AUTO; } String engineURI = getProperty("engineURI", line, configProperties, configPropertyFile); String brokerURL = getProperty("brokerURL", line, configProperties, configPropertyFile); Instant valuationTime = getValuationTime(line, configProperties, configPropertyFile); LocalDate observationDate = getObservationDate(line, configProperties, configPropertyFile); UniqueId viewDefinitionUniqueId = getViewDefinitionUniqueId(line, configProperties); URI vpBase; try { vpBase = new URI(engineURI); } catch (URISyntaxException ex) { throw new OpenGammaRuntimeException("Invalid URI", ex); } ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(brokerURL); activeMQConnectionFactory.setWatchTopicAdvisories(false); JmsConnectorFactoryBean jmsConnectorFactoryBean = new JmsConnectorFactoryBean(); jmsConnectorFactoryBean.setConnectionFactory(activeMQConnectionFactory); jmsConnectorFactoryBean.setName("Masters"); JmsConnector jmsConnector = jmsConnectorFactoryBean.getObjectCreating(); ScheduledExecutorService heartbeatScheduler = Executors.newSingleThreadScheduledExecutor(); try { ViewProcessor vp = new RemoteViewProcessor(vpBase, jmsConnector, heartbeatScheduler); ViewClient vc = vp.createViewClient(UserPrincipal.getLocalUser()); HistoricalMarketDataSpecification marketDataSpecification = MarketData.historical(observationDate, null); ViewExecutionOptions executionOptions = ExecutionOptions.batch(valuationTime, marketDataSpecification, null); vc.attachToViewProcess(viewDefinitionUniqueId, executionOptions); vc.waitForCompletion(); } finally { heartbeatScheduler.shutdown(); } }
From source file:org.dcm4che.tool.movescu.MoveSCU.java
@SuppressWarnings("unchecked") public static void main(String[] args) { try {//from w ww.j a v a 2 s . com CommandLine cl = parseComandLine(args); MoveSCU main = new MoveSCU(); CLIUtils.configureConnect(main.remote, main.rq, cl); CLIUtils.configureBind(main.conn, main.ae, cl); CLIUtils.configure(main.conn, cl); main.remote.setTlsProtocols(main.conn.getTlsProtocols()); main.remote.setTlsCipherSuites(main.conn.getTlsCipherSuites()); configureServiceClass(main, cl); configureKeys(main, cl); main.setPriority(CLIUtils.priorityOf(cl)); main.setDestination(destinationOf(cl)); ExecutorService executorService = Executors.newSingleThreadExecutor(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); main.setExecutor(executorService); main.setScheduledExecutor(scheduledExecutorService); try { main.open(); List<String> argList = cl.getArgList(); if (argList.isEmpty()) main.retrieve(); else for (String arg : argList) main.retrieve(new File(arg)); } finally { main.close(); executorService.shutdown(); scheduledExecutorService.shutdown(); } } catch (ParseException e) { System.err.println("movescu: " + e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println("movescu: " + e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:org.dcm4che.tool.stgcmtscu.StgCmtSCU.java
@SuppressWarnings("unchecked") public static void main(String[] args) { try {/*from w w w . j a va2s . co m*/ CommandLine cl = parseComandLine(args); Device device = new Device("stgcmtscu"); Connection conn = new Connection(); device.addConnection(conn); ApplicationEntity ae = new ApplicationEntity("STGCMTSCU"); device.addApplicationEntity(ae); ae.addConnection(conn); final StgCmtSCU stgcmtscu = new StgCmtSCU(ae); CLIUtils.configureConnect(stgcmtscu.remote, stgcmtscu.rq, cl); CLIUtils.configureBind(conn, stgcmtscu.ae, cl); CLIUtils.configure(conn, cl); stgcmtscu.remote.setTlsProtocols(conn.getTlsProtocols()); stgcmtscu.remote.setTlsCipherSuites(conn.getTlsCipherSuites()); stgcmtscu.setTransferSyntaxes(CLIUtils.transferSyntaxesOf(cl)); stgcmtscu.setStatus(CLIUtils.getIntOption(cl, "status", 0)); stgcmtscu.setSplitTag(getSplitTag(cl)); stgcmtscu.setKeepAlive(cl.hasOption("keep-alive")); stgcmtscu.setStorageDirectory(getStorageDirectory(cl)); stgcmtscu.setAttributes(new Attributes()); CLIUtils.addAttributes(stgcmtscu.attrs, cl.getOptionValues("s")); stgcmtscu.setUIDSuffix(cl.getOptionValue("uid-suffix")); List<String> argList = cl.getArgList(); boolean echo = argList.isEmpty(); if (!echo) { LOG.info(rb.getString("scanning")); DicomFiles.scan(argList, new DicomFiles.Callback() { @Override public boolean dicomFile(File f, Attributes fmi, long dsPos, Attributes ds) { return stgcmtscu.addInstance(ds); } }); } ExecutorService executorService = Executors.newCachedThreadPool(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); device.setExecutor(executorService); device.setScheduledExecutor(scheduledExecutorService); device.bindConnections(); try { stgcmtscu.open(); if (echo) stgcmtscu.echo(); else stgcmtscu.sendRequests(); } finally { stgcmtscu.close(); if (conn.isListening()) { device.waitForNoOpenConnections(); device.unbindConnections(); } executorService.shutdown(); scheduledExecutorService.shutdown(); } } catch (ParseException e) { System.err.println("stgcmtscu: " + e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println("stgcmtscu: " + e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:org.dcm4che.tool.storescp.StoreSCP.java
public static void main(String[] args) { try {//from w w w . j a va 2 s . co m CommandLine cl = parseComandLine(args); StoreSCP main = new StoreSCP(); CLIUtils.configureBindServer(main.conn, main.ae, cl); CLIUtils.configure(main.conn, cl); main.setStatus(CLIUtils.getIntOption(cl, "status", 0)); configureTransferCapability(main.ae, cl); configureStorageDirectory(main, cl); ExecutorService executorService = Executors.newCachedThreadPool(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); main.device.setScheduledExecutor(scheduledExecutorService); main.device.setExecutor(executorService); main.device.bindConnections(); } catch (ParseException e) { System.err.println("storescp: " + e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println("storescp: " + e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:org.dcm4che3.tool.movescu.MoveSCU.java
@SuppressWarnings("unchecked") public static void main(String[] args) { try {/*w w w. jav a2 s. c om*/ CommandLine cl = parseComandLine(args); MoveSCU main = new MoveSCU(); CLIUtils.configureConnect(main.remote, main.rq, cl); CLIUtils.configureBind(main.conn, main.ae, cl); CLIUtils.configure(main.conn, cl); main.remote.setTlsProtocols(main.conn.getTlsProtocols()); main.remote.setTlsCipherSuites(main.conn.getTlsCipherSuites()); configureServiceClass(main, cl); configureKeys(main, cl); main.setPriority(CLIUtils.priorityOf(cl)); main.setDestination(destinationOf(cl)); ExecutorService executorService = Executors.newSingleThreadExecutor(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); main.device.setExecutor(executorService); main.device.setScheduledExecutor(scheduledExecutorService); try { main.open(); List<String> argList = cl.getArgList(); if (argList.isEmpty()) main.retrieve(); else for (String arg : argList) main.retrieve(new File(arg)); } finally { main.close(); executorService.shutdown(); scheduledExecutorService.shutdown(); } } catch (ParseException e) { System.err.println("movescu: " + e.getMessage()); System.err.println(rb.getString("try")); System.exit(2); } catch (Exception e) { System.err.println("movescu: " + e.getMessage()); e.printStackTrace(); System.exit(2); } }
From source file:Main.java
private static ScheduledExecutorService getFileStoreExecutor() { if (storeExe == null) { storeExe = Executors.newSingleThreadScheduledExecutor(); }/*from w ww . j a v a2 s .c o m*/ return storeExe; }