Codota Logo
AbstractMessageProcessor
Code IndexAdd Codota to your IDE (free)

How to use
AbstractMessageProcessor
in
net.roboconf.messaging.api

Best Java code snippets using net.roboconf.messaging.api.AbstractMessageProcessor (Showing top 18 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: net.roboconf/roboconf-messaging-api

@Override
public final void run() {
  this.running.set( true );
  while( this.running.get()) {
    try {
      Message message = this.messageQueue.take();
      if( this.running.get())
        processMessage( message );
    } catch( InterruptedException e ) {
      break;
    }
  }
  Logger.getLogger( getClass().getName()).fine( "Roboconf's message processing thread is stopping." );
  this.running.set( false );
}
origin: roboconf/roboconf-platform

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IAgentClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
origin: roboconf/roboconf-platform

@Test
public void testProcessing() throws Exception {
  // The message is processed...
  this.processor.start();
  this.processor.storeMessage( new MsgCmdResynchronize());
  Thread.sleep( 1000 );
  this.processor.stopProcessor();
  Assert.assertEquals( 0, this.processor.getMessageQueue().size());
}
origin: net.roboconf/roboconf-dm

this.messagingClient.getMessageProcessor().stopProcessor();
this.messagingClient.getMessageProcessor().interrupt();
try {
  this.messagingClient.closeConnection();
origin: roboconf/roboconf-platform

@Test
public void testStartAndStop() throws Exception {
  Assert.assertFalse( this.processor.isRunning());
  this.processor.start();
  Thread.sleep( 200 );
  Assert.assertTrue( this.processor.isRunning());
  this.processor.stopProcessor();;
  Thread.sleep( 200 );
  Assert.assertFalse( this.processor.isRunning());
}
origin: roboconf/roboconf-platform

@Test
public void testInterrupt() throws Exception {
  Assert.assertFalse( this.processor.isRunning());
  this.processor.start();
  Thread.sleep( 200 );
  Assert.assertTrue( this.processor.isRunning());
  this.processor.interrupt();
  Thread.sleep( 200 );
  Assert.assertFalse( this.processor.isRunning());
}
origin: net.roboconf/roboconf-agent

  @Override
  public String agentStatus() {

    StringBuilder sb = new StringBuilder();

    // Messages
    LinkedBlockingQueue<Message> agentQueue = this.messagingClient.getMessageProcessor().getMessageQueue();
    if( agentQueue.isEmpty() ) {
      sb.append( "There is no message being processed in agent queue\n" );

    } else {
      sb.append( "Agent " + getScopedInstancePath() + " (" + getApplicationName() + ")\n" );
      sb.append( "The number total of messages in agent queue is : " + agentQueue.size() + "\n" );
      sb.append( "The types of messages being processed are : " + "\n");
      for( Message msg : agentQueue ) {
        sb.append( msg.getClass().getSimpleName() + "\n" );
      }
    }

    // Running processes
    Process p = ProcessStore.getProcess(this.applicationName, this.scopedInstancePath);
    if( p != null )
      sb.append( "Be careful. A recipe is under execution." );
    else
      sb.append( "No recipe is under execution." );

    return sb.toString();
  }
}
origin: roboconf/roboconf-platform

@After
public void terminateProcessor() {
  if( this.processor != null )
    this.processor.stopProcessor();
}
origin: net.roboconf/roboconf-messaging-api

/**
 * Associates a message processor with this instance.
 * <p>
 * The message processor cannot be started before. This method will start it.
 * </p>
 * <p>
 * This method must be invoked only once.
 * </p>
 * @param messageProcessor the message processor
 */
public void associateMessageProcessor( AbstractMessageProcessor<T> messageProcessor ) {
  if( this.messageProcessor != null )
    throw new IllegalArgumentException( "The message processor was already defined." );
  this.messageProcessor = messageProcessor;
  configureMessageProcessor( messageProcessor );
  this.messageProcessor.start();
}
origin: net.roboconf/roboconf-agent

this.messagingClient.getMessageProcessor().stopProcessor();
this.messagingClient.getMessageProcessor().interrupt();
this.messagingClient.closeConnection();
origin: roboconf/roboconf-platform

if( rawClient != null ) {
  newMessagingClient = new JmxWrapperForMessagingClient( rawClient );
  newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue());
  openConnection( newMessagingClient );
origin: roboconf/roboconf-platform

/**
 * Associates a message processor with this instance.
 * <p>
 * The message processor cannot be started before. This method will start it.
 * </p>
 * <p>
 * This method must be invoked only once.
 * </p>
 * @param messageProcessor the message processor
 */
public void associateMessageProcessor( AbstractMessageProcessor<T> messageProcessor ) {
  if( this.messageProcessor != null )
    throw new IllegalArgumentException( "The message processor was already defined." );
  this.messageProcessor = messageProcessor;
  configureMessageProcessor( messageProcessor );
  this.messageProcessor.start();
}
origin: roboconf/roboconf-platform

@After
public void releaseClients() throws Exception {
  for( ReconfigurableClient<?> client : this.clients ) {
    client.getMessageProcessor().stopProcessor();
    client.getMessageProcessor().interrupt();
    client.closeConnection();
  }
  this.clients.clear();
}
origin: net.roboconf/roboconf-messaging-api

if( rawClient != null ) {
  newMessagingClient = new JmxWrapperForMessagingClient( rawClient );
  newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue());
  openConnection( newMessagingClient );
origin: net.roboconf/roboconf-messaging-api

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IAgentClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
origin: roboconf/roboconf-platform

@Override
public final void run() {
  this.running.set( true );
  while( this.running.get()) {
    try {
      Message message = this.messageQueue.take();
      if( this.running.get())
        processMessage( message );
    } catch( InterruptedException e ) {
      break;
    }
  }
  Logger.getLogger( getClass().getName()).fine( "Roboconf's message processing thread is stopping." );
  this.running.set( false );
}
origin: net.roboconf/roboconf-messaging-api

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IDmClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
origin: roboconf/roboconf-platform

@Override
protected void configureMessageProcessor( AbstractMessageProcessor<IDmClient> messageProcessor ) {
  messageProcessor.setMessagingClient( this );
}
net.roboconf.messaging.apiAbstractMessageProcessor

Javadoc

A message processor is in charge of (guess what) processing messages.

The DM is supposed to have only one message processor running.
Same thing for an agent. When the DM or an agent stops, the processor thread should be stopped.

This class is a thread that will process messages. The method #stopProcessor() will stop processing messages after the current message is processed, or right after the next one is received. For an immediate stop, use the #interrupt() method.

Most used methods

  • getMessageQueue
  • interrupt
  • stopProcessor
    Stops the processor.
  • start
  • isRunning
  • processMessage
    Processes a message.
  • setMessagingClient
    This method must be invoked before #start(). It is not recommended to change the messaging client on
  • storeMessage
    Stores a message so that it can be processed later.

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • getContentResolver (Context)
  • setContentView (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now