code
stringlengths
73
34.1k
label
stringclasses
1 value
@Override public NetworkConnectionServiceMessage decode(final byte[] data) { try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) { try (final DataInputStream dais = new DataInputStream(bais)) { final String connFactoryId = dais.readUTF(); final Identifier srcId = factory.g...
java
private Schema createAvroSchema(final Configuration configuration, final MetadataFilter filter) throws IOException { final ParquetMetadata footer = ParquetFileReader.readFooter(configuration, parquetFilePath, filter); final AvroSchemaConverter converter = new AvroSchemaConverter(); final MessageType schema ...
java
public void serializeToDisk(final File file) throws IOException { final DatumWriter datumWriter = new GenericDatumWriter<GenericRecord>(); final DataFileWriter fileWriter = new DataFileWriter<GenericRecord>(datumWriter); final AvroParquetReader<GenericRecord> reader = createAvroReader(); fileWriter.crea...
java
public ByteBuffer serializeToByteBuffer() throws IOException { final ByteArrayOutputStream stream = new ByteArrayOutputStream(); final Encoder encoder = EncoderFactory.get().binaryEncoder(stream, null); final DatumWriter writer = new GenericDatumWriter<GenericRecord>(); writer.setSchema(createAvroSchema...
java
public static String getTaskId(final Configuration config) { try { return Tang.Factory.getTang().newInjector(config).getNamedInstance(TaskConfigurationOptions.Identifier.class); } catch (final InjectionException ex) { throw new RuntimeException("Unable to determine task identifier. Giving up.", ex);...
java
public static DriverLauncher getLauncher(final Configuration runtimeConfiguration) throws InjectionException { return Tang.Factory.getTang() .newInjector(runtimeConfiguration, CLIENT_CONFIG) .getInstance(DriverLauncher.class); }
java
@Override public void close() { synchronized (this) { LOG.log(Level.FINER, "Close launcher: job {0} with status {1}", new Object[] {this.theJob, this.status}); if (this.status.isRunning()) { this.status = LauncherStatus.FORCE_CLOSED; } if (null != this.theJob) { this.theJob...
java
public LauncherStatus run(final Configuration driverConfig) { this.reef.submit(driverConfig); synchronized (this) { while (!this.status.isDone()) { try { LOG.log(Level.FINE, "Wait indefinitely"); this.wait(); } catch (final InterruptedException ex) { LOG.log(L...
java
public String submit(final Configuration driverConfig, final long waitTime) { this.reef.submit(driverConfig); this.waitForStatus(waitTime, LauncherStatus.SUBMITTED); return this.jobId; }
java
public LauncherStatus run(final Configuration driverConfig, final long timeOut) { final long startTime = System.currentTimeMillis(); this.reef.submit(driverConfig); this.waitForStatus(timeOut - System.currentTimeMillis() + startTime, LauncherStatus.COMPLETED); if (System.currentTimeMillis() - startTi...
java
public synchronized void setStatusAndNotify(final LauncherStatus newStatus) { LOG.log(Level.FINEST, "Set status: {0} -> {1}", new Object[] {this.status, newStatus}); this.status = newStatus; this.notify(); }
java
private void logAll() { synchronized (this) { final StringBuilder sb = new StringBuilder(); Level highestLevel = Level.FINEST; for (final LogRecord record : this.logs) { sb.append(formatter.format(record)); sb.append("\n"); if (record.getLevel().intValue() > highestLevel.in...
java
private int getLevel(final Level recordLevel) { if (recordLevel.equals(Level.OFF)) { return 0; } else if (recordLevel.equals(Level.SEVERE)) { return 1; } else if (recordLevel.equals(Level.WARNING)) { return 2; } else if (recordLevel.equals(Level.ALL)) { return 4; } else { ...
java
public List<HeaderEntry> getHeaderEntryList() { final List<HeaderEntry> list = new ArrayList<>(); final Iterator it = this.headers.entrySet().iterator(); while (it.hasNext()) { final Map.Entry pair = (Map.Entry)it.next(); System.out.println(pair.getKey() + " = " + pair.getValue()); final H...
java
public void close(final byte[] message) { LOG.log(Level.FINEST, "Triggering Task close."); synchronized (this.heartBeatManager) { if (this.currentStatus.isNotRunning()) { LOG.log(Level.WARNING, "Trying to close a task that is in state: {0}. Ignoring.", this.currentStatus.getState()); ...
java
public void suspend(final byte[] message) { synchronized (this.heartBeatManager) { if (this.currentStatus.isNotRunning()) { LOG.log(Level.WARNING, "Trying to suspend a task that is in state: {0}. Ignoring.", this.currentStatus.getState()); } else { try { this.suspen...
java
public void deliver(final byte[] message) { synchronized (this.heartBeatManager) { if (this.currentStatus.isNotRunning()) { LOG.log(Level.WARNING, "Trying to send a message to a task that is in state: {0}. Ignoring.", this.currentStatus.getState()); } else { try {...
java
@SuppressWarnings("checkstyle:illegalcatch") private void closeTask(final byte[] message) throws TaskCloseHandlerFailure { LOG.log(Level.FINEST, "Invoking close handler."); try { this.fCloseHandler.get().onNext(new CloseEventImpl(message)); } catch (final Throwable throwable) { throw new TaskC...
java
@SuppressWarnings("checkstyle:illegalcatch") private void deliverMessageToTask(final byte[] message) throws TaskMessageHandlerFailure { try { this.fMessageHandler.get().onNext(new DriverMessageImpl(message)); } catch (final Throwable throwable) { throw new TaskMessageHandlerFailure(throwable); ...
java
@SuppressWarnings("checkstyle:illegalcatch") private void suspendTask(final byte[] message) throws TaskSuspendHandlerFailure { try { this.fSuspendHandler.get().onNext(new SuspendEventImpl(message)); } catch (final Throwable throwable) { throw new TaskSuspendHandlerFailure(throwable); } }
java
@Override public void onNext(final TransportEvent e) { final RemoteEvent<byte[]> re = codec.decode(e.getData()); re.setLocalAddress(e.getLocalAddress()); re.setRemoteAddress(e.getRemoteAddress()); if (LOG.isLoggable(Level.FINER)) { LOG.log(Level.FINER, "{0} {1}", new Object[]{e, re}); } ...
java
public final <T> ConfigurationModule setMultiple(final Param<T> opt, final Iterable<String> values) { ConfigurationModule c = deepCopy(); for (final String val : values) { c = c.set(opt, val); } return c; }
java
private static List<String> toConfigurationStringList(final Configuration c) { final ConfigurationImpl conf = (ConfigurationImpl) c; final List<String> l = new ArrayList<>(); for (final ClassNode<?> opt : conf.getBoundImplementations()) { l.add(opt.getFullName() + '=' + escape(conf...
java
@Override @SuppressWarnings("checkstyle:illegalcatch") public void onNext(final T value) { beforeOnNext(); try { handler.onNext(value); } catch (final Throwable t) { if (errorHandler != null) { errorHandler.onNext(t); } else { LOG.log(Level.SEVERE, name + " Exception fr...
java
public synchronized void send(final ReefServiceProtos.JobStatusProto status) { LOG.log(Level.FINEST, "Sending to client: status={0}", status.getState()); this.jobStatusHandler.onNext(status); }
java
@SuppressWarnings("checkstyle:illegalcatch") // Catch throwable to feed it to error handler public static REEFEnvironment fromConfiguration( final UserCredentials hostUser, final Configuration... configurations) throws InjectionException { final Configuration config = Configurations.merge(configurations); ...
java
@Override public void write(final T message) { this.link.write(new NSMessage<T>(this.srcId, this.destId, message)); }
java
@Override public Configuration getMainConfiguration() { return Tang.Factory.getTang().newConfigurationBuilder() .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class) .bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstruct...
java
public boolean block(final long identifier, final Runnable asyncProcessor) throws InterruptedException, InvalidIdentifierException { final ComplexCondition call = allocate(); if (call.isHeldByCurrentThread()) { throw new RuntimeException("release() must not be called on same thread as block() to ...
java
public void release(final long identifier) throws InterruptedException, InvalidIdentifierException { final ComplexCondition call = getSleeper(identifier); if (call.isHeldByCurrentThread()) { throw new RuntimeException("release() must not be called on same thread as block() to prevent deadlock"); } ...
java
private ComplexCondition allocate() { final ComplexCondition call = freeQueue.poll(); return call != null ? call : new ComplexCondition(timeoutPeriod, timeoutUnits); }
java
private void addSleeper(final long identifier, final ComplexCondition call) { if (sleeperMap.put(identifier, call) != null) { throw new RuntimeException(String.format("Duplicate identifier [%d] in sleeper map", identifier)); } }
java
private ComplexCondition getSleeper(final long identifier) throws InvalidIdentifierException { final ComplexCondition call = sleeperMap.get(identifier); if (null == call) { throw new InvalidIdentifierException(identifier); } return call; }
java
private void removeSleeper(final long identifier) throws InvalidIdentifierException { final ComplexCondition call = sleeperMap.remove(identifier); if (null == call) { throw new InvalidIdentifierException(identifier); } }
java
@SuppressWarnings("unchecked") private <T> T parseBoundNamedParameter(final NamedParameterNode<T> np) { final T ret; @SuppressWarnings("rawtypes") final Set<Object> boundSet = c.getBoundSet((NamedParameterNode) np); if (!boundSet.isEmpty()) { final Set<T> ret2 = new MonotonicSet<>(); for ...
java
public void subscribe(final Class<? extends T> clazz, final EventHandler<? extends T> handler) { lock.writeLock().lock(); try { List<EventHandler<? extends T>> list = clazzToListOfHandlersMap.get(clazz); if (list == null) { list = new LinkedList<EventHandler<? extends T>>(); clazzToL...
java
@Override public void onNext(final T event) { LOG.log(Level.FINEST, "Invoked for event: {0}", event); lock.readLock().lock(); final List<EventHandler<? extends T>> list; try { list = clazzToListOfHandlersMap.get(event.getClass()); if (list == null) { throw new WakeRuntimeException(...
java
public static GroupCommunicationMessage getGCM(final Message<GroupCommunicationMessage> msg) { final Iterator<GroupCommunicationMessage> gcmIterator = msg.getData().iterator(); if (gcmIterator.hasNext()) { final GroupCommunicationMessage gcm = gcmIterator.next(); if (gcmIterator.hasNext()) { ...
java
public static void main(final String[] args) throws InjectionException { LOG.log(Level.FINE, "Launching Unmanaged AM: {0}", JAR_PATH); try (final DriverLauncher client = DriverLauncher.getLauncher(RUNTIME_CONFIG)) { final String appId = client.submit(DRIVER_CONFIG, 10000); LOG.log(Level.INFO, "Jo...
java
@Override public void onNext(final T value) { beforeOnNext(); executor.submit(new Runnable() { @Override public void run() { observer.onNext(value); afterOnNext(); } }); }
java
@Override public void onError(final Exception error) { submitCompletion(new Runnable() { @Override public void run() { observer.onError(error); } }); }
java
@Override @SuppressWarnings("checkstyle:illegalcatch") public void onNext(final T value) { beforeOnNext(); try { executor.submit(new Runnable() { @Override public void run() { try { handler.onNext(value); } catch (final Throwable t) { if (er...
java
public static DriverFiles fromJobSubmission( final JobSubmissionEvent jobSubmissionEvent, final REEFFileNames fileNames) throws IOException { final DriverFiles driverFiles = new DriverFiles(fileNames); for (final FileResource frp : jobSubmissionEvent.getGlobalFileSet()) { final File f = new ...
java
public ConfigurationModule addNamesTo(final ConfigurationModule input, final OptionalParameter<String> globalFileField, final OptionalParameter<String> globalLibField, final OptionalParameter<String> ...
java
private File downloadToTempFolder(final String applicationId) throws URISyntaxException, StorageException, IOException { final File outputFolder = Files.createTempDirectory("reeflogs-" + applicationId).toFile(); if (!outputFolder.exists() && !outputFolder.mkdirs()) { LOG.log(Level.WARNING, "Failed t...
java
@Override public void unregister(final Identifier id) { LOG.log(Level.FINE, "id: " + id); idToAddrMap.remove(id); }
java
@Override public InetSocketAddress lookup(final Identifier id) { LOG.log(Level.FINE, "id: {0}", id); return idToAddrMap.get(id); }
java
@Override public List<NameAssignment> lookup(final Iterable<Identifier> identifiers) { LOG.log(Level.FINE, "identifiers"); final List<NameAssignment> nas = new ArrayList<>(); for (final Identifier id : identifiers) { final InetSocketAddress addr = idToAddrMap.get(id); LOG.log(Level.FINEST, "id...
java
private String getQueue(final Configuration driverConfiguration) { try { return Tang.Factory.getTang().newInjector(driverConfiguration).getNamedInstance(JobQueue.class); } catch (final InjectionException e) { return this.defaultQueueName; } }
java
@SuppressWarnings("checkstyle:illegalcatch") void startTask(final Configuration taskConfig) throws TaskClientCodeException { synchronized (this.contextLifeCycle) { if (this.task.isPresent() && this.task.get().hasEnded()) { // clean up state this.task = Optional.empty(); } if (...
java
void close() { synchronized (this.contextLifeCycle) { this.contextState = ReefServiceProtos.ContextStatusProto.State.DONE; if (this.task.isPresent()) { LOG.log(Level.WARNING, "Shutting down a task because the underlying context is being closed."); this.task.get().close(null); } ...
java
public static LauncherStatus runHelloReef(final Configuration runtimeConf, final int timeOut) throws BindException, InjectionException { final Configuration driverConf = Configurations.merge(HelloREEFHttp.getDriverConfiguration(), getHTTPConfiguration()); return DriverLauncher.getLauncher(runtimeC...
java
@Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { this.channelGroup.add(ctx.channel()); this.listener.channelActive(ctx); super.channelActive(ctx); }
java
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { this.listener.channelInactive(ctx); super.channelInactive(ctx); }
java
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) { final Channel channel = ctx.channel(); LOG.log(Level.INFO, "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}", new Object[]{channel, channel.localAddress(), channel.remoteAddress()...
java
@Override public RemoteEvent<T> decode(final byte[] data) { final WakeMessagePBuf pbuf; try { pbuf = WakeMessagePBuf.parseFrom(data); return new RemoteEvent<T>(null, null, pbuf.getSeq(), decoder.decode(pbuf.getData().toByteArray())); } catch (final InvalidProtocolBufferException e) { thr...
java
public boolean setEvaluatorRestartState(final EvaluatorRestartState to) { if (this.evaluatorRestartState.isLegalTransition(to)) { this.evaluatorRestartState = to; return true; } return false; }
java
private static Configuration getCLRTaskConfiguration(final String taskId) throws BindException { final ConfigurationBuilder taskConfigurationBuilder = Tang.Factory.getTang() .newConfigurationBuilder(loadClassHierarchy()); taskConfigurationBuilder.bind("Org.Apache.Reef.Tasks.TaskConfigurationOptions+Iden...
java
private static ClassHierarchy loadClassHierarchy() { // TODO[JIRA REEF-400] The file should be created by AvroClassHierarchySerializer try (final InputStream chin = new FileInputStream(HelloCLR.CLASS_HIERARCHY_FILENAME)) { // TODO[JIRA REEF-400] Use AvroClassHierarchySerializer instead final ClassHi...
java
void onNextCLR(final AllocatedEvaluator allocatedEvaluator) { try { allocatedEvaluator.setProcess(clrProcessFactory.newEvaluatorProcess()); final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "HelloREEFContext") .build(); ...
java
void onNextJVM(final AllocatedEvaluator allocatedEvaluator) { try { final Configuration contextConfiguration = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, "HelloREEFContext") .build(); final Configuration taskConfiguration = TaskConfiguration.CONF .set(...
java
@Override public Configuration getServiceConfiguration() { final Configuration partialServiceConf = ServiceConfiguration.CONF .set(ServiceConfiguration.SERVICES, taskOutputStreamProvider.getClass()) .set(ServiceConfiguration.ON_CONTEXT_STOP, ContextStopHandler.class) .set(ServiceConfigura...
java
static LocalSubmissionFromCS fromSubmissionParameterFiles(final File localJobSubmissionParametersFile, final File localAppSubmissionParametersFile) throws IOException { final AvroLocalAppSubmissionParameters localAppSubmissionParameters; final A...
java
public static byte[] toByteArray(final ByteString bs) { return bs == null || bs.isEmpty() ? null : bs.toByteArray(); }
java
public static ExceptionInfo createExceptionInfo(final ExceptionCodec exceptionCodec, final Throwable ex) { return ExceptionInfo.newBuilder() .setName(ex.getCause() != null ? ex.getCause().toString() : ex.toString()) .setMessage(StringUtils.isNotEmpty(ex.getMessage()) ? ex.getMessage() : ex.toString...
java
public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo( final EvaluatorDescriptor descriptor) { if (descriptor == null) { return null; } EvaluatorDescriptorInfo.NodeDescriptorInfo nodeDescriptorInfo = descriptor.getNodeDescriptor() == null ? null : EvaluatorDescriptorInfo.NodeDe...
java
public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) { final ContextInfo.Builder builder = ContextInfo.newBuilder() .setContextId(context.getId()) .setEvaluatorId(context.getEvaluatorId()) .setParentId(context.getParentId().orElse("")) .setEva...
java
private Configuration getTaskConfiguration(final String taskId) { try { return TaskConfiguration.CONF .set(TaskConfiguration.IDENTIFIER, taskId) .set(TaskConfiguration.TASK, SleepTask.class) .build(); } catch (final BindException ex) { LOG.log(Level.SEVERE, "Failed to c...
java
String waitAndGetMessage() { synchronized (this) { // Wait for a message to send. while (this.statusMessagesToSend.isEmpty()) { try { this.wait(); } catch (final InterruptedException e) { LOG.log(Level.FINE, "Interrupted. Ignoring."); } } // Send ...
java
@Override public void addTokens(final byte[] tokens) { try (final DataInputBuffer buf = new DataInputBuffer()) { buf.reset(tokens, tokens.length); final Credentials credentials = new Credentials(); credentials.readTokenStorageStream(buf); final UserGroupInformation ugi = UserGroupInform...
java
public static byte[] serializeToken(final Token<AMRMTokenIdentifier> token) { try (final DataOutputBuffer dob = new DataOutputBuffer()) { final Credentials credentials = new Credentials(); credentials.addToken(token.getService(), token); credentials.writeTokenStorageToStream(dob); return dob...
java
@Override public final synchronized void onHttpRequest(final ParsedHttpRequest parsedHttpRequest, final HttpServletResponse response) throws IOException, ServletException { LOG.log(Level.INFO, "HttpServeShellCmdHandler in webserver onHttpRequest is called: {0}"...
java
public final synchronized void onHttpCallback(final byte[] message) { final long endTime = System.currentTimeMillis() + WAIT_TIMEOUT; while (cmdOutput != null) { final long waitTime = endTime - System.currentTimeMillis(); if (waitTime <= 0) { break; } try { wait(WAIT_TIM...
java
public static void runTaskScheduler(final Configuration runtimeConf, final String[] args) throws InjectionException, IOException, ParseException { final Tang tang = Tang.Factory.getTang(); final Configuration commandLineConf = CommandLine.parseToConfiguration(args, Retain.class); // Merge the configur...
java
@Override public void start(final VortexThreadPool vortexThreadPool) { final List<Matrix<Double>> leftSplits = generateMatrixSplits(numRows, numColumns, divideFactor); final Matrix<Double> right = generateIdentityMatrix(numColumns); // Measure job finish time starting from here.. final double start =...
java
private Matrix<Double> generateRandomMatrix(final int nRows, final int nColumns) { final List<List<Double>> rows = new ArrayList<>(nRows); final Random random = new Random(); for (int i = 0; i < nRows; i++) { final List<Double> row = new ArrayList<>(nColumns); for (int j = 0; j < nColumns; j++) ...
java
private Matrix<Double> generateIdentityMatrix(final int numDimension) { final List<List<Double>> rows = new ArrayList<>(numDimension); for (int i = 0; i < numDimension; i++) { final List<Double> row = new ArrayList<>(numDimension); for (int j = 0; j < numDimension; j++) { final double value ...
java
public Topology getNewInstance(final Class<? extends Name<String>> operatorName, final Class<? extends Topology> topologyClass) throws InjectionException { final Injector newInjector = injector.forkInjector(); newInjector.bindVolatileParameter(OperatorNameClass.class, operatorNa...
java
public static void main(final String[] args) throws InjectionException, IOException { final Configuration partialConfiguration = getEnvironmentConfiguration(); final Injector injector = Tang.Factory.getTang().newInjector(partialConfiguration); final AzureBatchRuntimeConfigurationProvider runtimeConfigurati...
java
private void returnResults() { final StringBuilder sb = new StringBuilder(); for (final String result : this.results) { sb.append(result); } this.results.clear(); LOG.log(Level.INFO, "Return results to the client:\n{0}", sb); httpCallbackHandler.onNext(CODEC.encode(sb.toString())); }
java
private synchronized void submit(final String command) { LOG.log(Level.INFO, "Submit command {0} to {1} evaluators. state: {2}", new Object[]{command, this.contexts.size(), this.state}); assert this.state == State.READY; this.expectCount = this.contexts.size(); this.state = State.WAIT_TASKS; ...
java
private synchronized void requestEvaluators() { assert this.state == State.INIT; LOG.log(Level.INFO, "Schedule on {0} Evaluators.", this.numEvaluators); this.evaluatorRequestor.newRequest() .setMemory(128) .setNumberOfCores(1) .setNumber(this.numEvaluators) .submit(); thi...
java
private void submit(final ActiveContext context) { try { LOG.log(Level.INFO, "Send task to context: {0}", new Object[]{context}); if (JobDriver.this.handlerManager.getActiveContextHandler() == 0) { throw new RuntimeException("Active Context Handler not initialized by CLR."); } final ...
java
private static String readFile(final String fileName) throws IOException { return new String(Files.readAllBytes(Paths.get(fileName)), StandardCharsets.UTF_8); }
java
private void writeEvaluatorInfoJsonOutput( final HttpServletResponse response, final List<String> ids) throws IOException { try { final EvaluatorInfoSerializer serializer = Tang.Factory.getTang().newInjector().getInstance(EvaluatorInfoSerializer.class); final AvroEvaluatorsInfo evaluator...
java
private void writeEvaluatorInfoWebOutput( final HttpServletResponse response, final List<String> ids) throws IOException { for (final String id : ids) { final EvaluatorDescriptor evaluatorDescriptor = this.reefStateManager.getEvaluators().get(id); final PrintWriter writer = response.getWriter();...
java
private void writeEvaluatorsJsonOutput(final HttpServletResponse response) throws IOException { LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsJsonOutput is called"); try { final EvaluatorListSerializer serializer = Tang.Factory.getTang().newInjector().getInstance(EvaluatorListSe...
java
private void writeEvaluatorsWebOutput(final HttpServletResponse response) throws IOException { LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsWebOutput is called"); final PrintWriter writer = response.getWriter(); writer.println("<h1>Evaluators:</h1>"); for (final Map.Entry<String, E...
java
private void writeDriverJsonInformation(final HttpServletResponse response) throws IOException { LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverJsonInformation invoked."); try { final DriverInfoSerializer serializer = Tang.Factory.getTang().newInjector().getInstance(DriverInfoSeria...
java
private void writeResponse(final HttpServletResponse response, final String data) throws IOException { final byte[] outputBody = data.getBytes(StandardCharsets.UTF_8); response.getOutputStream().write(outputBody); }
java
private void writeDriverWebInformation(final HttpServletResponse response) throws IOException { LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverWebInformation invoked."); final PrintWriter writer = response.getWriter(); writer.println("<h1>Driver Information:</h1>"); writer.println(String...
java
private void writeLines(final HttpServletResponse response, final ArrayList<String> lines, final String header) throws IOException { LOG.log(Level.INFO, "HttpServerReefEventHandler writeLines is called"); final PrintWriter writer = response.getWriter(); writer.println("<h1>" + header + "</h1>"); ...
java
@Override public void close() { LOG.log(Level.FINE, "Closing netty transport socket address: {0}", this.localAddress); final ChannelGroupFuture clientChannelGroupFuture = this.clientChannelGroup.close(); final ChannelGroupFuture serverChannelGroupFuture = this.serverChannelGroup.close(); final Chann...
java
public <T> Link<T> get(final SocketAddress remoteAddr) { final LinkReference linkRef = this.addrToLinkRefMap.get(remoteAddr); return linkRef != null ? (Link<T>) linkRef.getLink() : null; }
java
@Override public void registerErrorHandler(final EventHandler<Exception> handler) { this.clientEventListener.registerErrorHandler(handler); this.serverEventListener.registerErrorHandler(handler); }
java
@SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition") public AutoCloseable registerHandler( final RemoteIdentifier sourceIdentifier, final Class<? extends T> messageType, final EventHandler<? super T> theHandler) { final Tuple2<RemoteIdentifier, Class<? extends T>> tuple = ...
java
public AutoCloseable registerHandler( final Class<? extends T> messageType, final EventHandler<RemoteMessage<? extends T>> theHandler) { this.msgTypeToHandlerMap.put(messageType, theHandler); LOG.log(Level.FINER, "Add handler for class: {0}", messageType.getCanonicalName()); return new Subscr...
java
public AutoCloseable registerErrorHandler(final EventHandler<Exception> theHandler) { this.transport.registerErrorHandler(theHandler); return new SubscriptionHandler<>( new Exception("Token for finding the error handler subscription"), this.unsubscribeException); }
java
public void unsubscribe(final Subscription<T> subscription) { final T token = subscription.getToken(); LOG.log(Level.FINER, "RemoteManager: {0} token {1}", new Object[]{this.name, token}); if (token instanceof Exception) { this.transport.registerErrorHandler(null); } else if (token instanceof Tupl...
java
@Override @SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition") public synchronized void onNext(final RemoteEvent<byte[]> value) { LOG.log(Level.FINER, "RemoteManager: {0} value: {1}", new Object[] {this.name, value}); final T decodedEvent = this.codec.decode(value.getEvent()); final Cl...
java