/* (non-Javadoc) * @see org.eclipse.californium.core.network.Endpoint#start() */ @Override public synchronized void start() throws IOException { if (started) { LOGGER.log(Level.FINE, "Endpoint at " + getAddress().toString() + " is already started"); return; } if (!this.coapstack.hasDeliverer()) this.coapstack.setDeliverer(new ClientMessageDeliverer()); if (this.executor == null) { LOGGER.config( "Endpoint " + toString() + " requires an executor to start. Using default single-threaded daemon executor."); final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(new Utils.DaemonThreadFactory()); setExecutor(executor); addObserver( new EndpointObserver() { public void started(Endpoint endpoint) {} public void stopped(Endpoint endpoint) {} public void destroyed(Endpoint endpoint) { executor.shutdown(); } }); } try { LOGGER.log(Level.INFO, "Starting endpoint at " + getAddress()); started = true; matcher.start(); connector.start(); for (EndpointObserver obs : observers) obs.started(this); startExecutor(); } catch (IOException e) { // free partially acquired resources stop(); throw e; } }