Examples of Event


Examples of org.xlightweb.Event

                    private int id = Integer.parseInt(exchange.getRequest().getHeader("Last-Event-Id", "0"));
                   
                    public void run() {
                        try {
                            Event event = new Event(new Date().toString(), ++id);
                            sink.write(event.toString());
                        } catch (IOException ioe) {
                            cancel();
                            sink.destroy();
                        }
                    };
                };
               
                Event event = new Event();
                event.setRetryMillis(5 * 1000);
                sink.write(event.toString());
               
                timer.schedule(tt, 3000, 3000);
            }
        }

View Full Code Here

Examples of org.yaml.snakeyaml.events.Event

        } else {
            reader = new StreamReader(new StringReader(target.convertToString().asJavaString()));
        }
        Parser parser = new ParserImpl(reader);
        IRubyObject handler = getInstanceVariable("@handler");
        Event event;

        while (true) {
            try {
                event = parser.getEvent();

                // FIXME: Event should expose a getID, so it can be switched
                if (event.is(ID.StreamStart)) {
                    invoke(
                            context,
                            handler,
                            "start_stream",
                            runtime.newFixnum(YAML_ANY_ENCODING));
                } else if (event.is(ID.DocumentStart)) {
                    DocumentStartEvent dse = (DocumentStartEvent)event;

                    Integer[] versionInts = dse.getVersion();
                    IRubyObject version = versionInts == null ?
                        runtime.getNil() :
                        RubyArray.newArray(runtime, runtime.newFixnum(versionInts[0]), runtime.newFixnum(versionInts[1]));
                   
                    Map<String, String> tagsMap = dse.getTags();
                    RubyArray tags = RubyArray.newArray(runtime);
                    if (tags.size() > 0) {
                        for (Map.Entry<String, String> tag : tagsMap.entrySet()) {
                            tags.append(RubyArray.newArray(
                                    runtime,
                                    RubyString.newString(runtime, tag.getKey()),
                                    RubyString.newString(runtime, tag.getValue())));
                        }
                    }

                    invoke(
                            context,
                            handler,
                            "start_document",
                            version,
                            tags,
                            runtime.newBoolean(dse.getExplicit()));
                } else if (event.is(ID.DocumentEnd)) {
                    DocumentEndEvent dee = (DocumentEndEvent)event;
                    invoke(
                            context,
                            handler,
                            "end_document",
                            runtime.newBoolean(dee.getExplicit()));
                } else if (event.is(ID.Alias)) {
                    AliasEvent ae = (AliasEvent)event;
                    IRubyObject alias = runtime.getNil();
                    if (ae.getAnchor() != null) {
                        alias = RubyString.newString(runtime, ae.getAnchor());
                    }

                    invoke(
                            context,
                            handler,
                            "alias",
                            alias);
                } else if (event.is(ID.Scalar)) {
                    ScalarEvent se = (ScalarEvent)event;
                    IRubyObject anchor = se.getAnchor() == null ?
                        runtime.getNil() :
                        RubyString.newString(runtime, se.getAnchor());
                    IRubyObject tag = se.getTag() == null ?
                        runtime.getNil() :
                        RubyString.newString(runtime, se.getTag());
                    IRubyObject plain_implicit = runtime.newBoolean(se.getImplicit().isFirst());
                    IRubyObject quoted_implicit = runtime.newBoolean(se.getImplicit().isSecond());
                    IRubyObject style = runtime.newFixnum(se.getStyle());
                    IRubyObject val = RubyString.newString(runtime, se.getValue());

                    invoke(
                            context,
                            handler,
                            "scalar",
                            val,
                            anchor,
                            tag,
                            plain_implicit,
                            quoted_implicit,
                            style);
                } else if (event.is(ID.SequenceStart)) {
                    SequenceStartEvent sse = (SequenceStartEvent)event;
                    IRubyObject anchor = sse.getAnchor() == null ?
                        runtime.getNil() :
                        RubyString.newString(runtime, sse.getAnchor());
                    IRubyObject tag = sse.getTag() == null ?
                        runtime.getNil() :
                        RubyString.newString(runtime, sse.getTag());
                    IRubyObject implicit = runtime.newBoolean(sse.getImplicit());
                    IRubyObject style = runtime.newFixnum(sse.getFlowStyle() ? 1 : 0);

                    invoke(
                            context,
                            handler,
                            "start_sequence",
                            anchor,
                            tag,
                            implicit,
                            style);
                } else if (event.is(ID.SequenceEnd)) {
                    invoke(
                            context,
                            handler,
                            "end_sequence");
                } else if (event.is(ID.MappingStart)) {
                    MappingStartEvent mse = (MappingStartEvent)event;
                    IRubyObject anchor = mse.getAnchor() == null ?
                        runtime.getNil() :
                        RubyString.newString(runtime, mse.getAnchor());
                    IRubyObject tag = mse.getTag() == null ?
                        runtime.getNil() :
                        RubyString.newString(runtime, mse.getTag());
                    IRubyObject implicit = runtime.newBoolean(mse.getImplicit());
                    IRubyObject style = runtime.newFixnum(mse.getFlowStyle() ? 1 : 0);

                    invoke(
                            context,
                            handler,
                            "start_mapping",
                            anchor,
                            tag,
                            implicit,
                            style);
                } else if (event.is(ID.MappingEnd)) {
                    invoke(
                            context,
                            handler,
                            "end_mapping");
                } else if (event.is(ID.StreamEnd)) {
                    invoke(
                            context,
                            handler,
                            "end_stream");
                    break;
View Full Code Here

Examples of org.zeromq.ZMQ.Event

    public void testEventConnected() {
        if (ZMQ.version_full() < ZMQ.make_version(3, 2, 2)) // Monitor added in 3.2.2
            return;
       
        Context context = ZMQ.context(1);
        Event event;
       
        Socket helper = context.socket(ZMQ.REQ);
        int port = helper.bindToRandomPort("tcp://127.0.0.1");
       
        Socket socket = context.socket(ZMQ.REP);
        Socket monitor = context.socket(ZMQ.PAIR);
        monitor.setReceiveTimeOut(100);
       
        assertTrue(socket.monitor("inproc://monitor.socket", ZMQ.EVENT_CONNECTED));
        monitor.connect("inproc://monitor.socket");
       
        socket.connect("tcp://127.0.0.1:" + port);
        event = Event.recv(monitor);
        assertNotNull("No event was received", event);
        assertEquals(ZMQ.EVENT_CONNECTED, event.getEvent());
       
        helper.close();
        socket.close();
        monitor.close();
        context.term();
View Full Code Here

Examples of org.zkoss.zk.ui.event.Event

      }
    });
  }

  public void fireChangeEvent() {
    Events.sendEvent(new Event(Events.ON_CHANGE, this));
  }
View Full Code Here

Examples of papaya.event.Event

 
  static LogWrapper testLogWrapper = new LogWrapper("Tests");
  public static void main(String[] args) {
     bus.register(EventBusTests.class);
     try {
      bus.post(new Event(Collections.class, "dummy_event",new int[]{1,2,3},1,2,3,'a','b'));
    } catch( Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of pec.Event

   * Mevents and an Observation Event. After that, the main function begins a cycle of removing Events from the PEC
   * and adding new Events if they are generated. The simulation finishes when a
   * finish Exception is caught.
   */
  public void run(){
    Event event;
    LinkedList<ACOEvent> newEventList;//list to hold newly generated events
   
    /*Create a new Adjacency list graph and pass its reference to the
     *SaxParser.*/
    AdjListGraph<Float> graph = new AdjListGraph<Float>();
    try {
      SimParser saxParser = new SimParser(graph, file);
      saxParser.parse();
    }catch (IOException e){
      System.out.println("Failed to open dtd file: The file simulation.dtd must be in the same directory of the " +
          "xml simulation file");
      //e.printStackTrace();
      return;
    }catch (ParserConfigurationException e){
      System.out.println("SAX related Error: "+e.getMessage());
      //e.printStackTrace();
      return;
    }catch (SAXException e){
      System.out.println("SAX related Error: "+e.getMessage());
      //e.printStackTrace();
      return;
    }
    /*Create a new PriorityQueue-PEC and fill it with a new
     *Mevent for each ant in the ant colony*/
    PEC pec = new PQPEC();
    for(int i=0;i<antColSize;i++){
      event = new Mevent(new Float(0), graph);
      pec.addEvent(event);
    }
   
    /*Create the observation Event and put it in the PEC*/
    event = new Observation();
    pec.addEvent(event);
   
    /*PEC event retrieval cycle*/
    while((event = pec.getEvent())!=null){
      try{//Simulate
        newEventList = (LinkedList<ACOEvent>)event.processEvent();
      }catch (FinishException finish){//If the Event processing throws a finish Exception
        //System.out.println("Simulation finished: "+finish.getMessage());
        return;//End of Simulation
      }catch (InvalidGraphException invg){
        System.out.println("Bad Graph Design Error: " + invg.getMessage());
View Full Code Here

Examples of reactor.event.Event

    @Override
    public void fireCloudbreakEvent(Long stackId, String eventType, String eventMessage) {
        CloudbreakEventData eventData = new CloudbreakEventData(stackId, eventType, eventMessage);
        MDCBuilder.buildMdcContext(eventData);
        LOGGER.info("Fireing cloudbreak event: {}", eventData);
        Event reactorEvent = Event.wrap(eventData);
        reactor.notify(ReactorConfig.CLOUDBREAK_EVENT, reactorEvent);
    }
View Full Code Here

Examples of riemann.codec.Event

  }
  public void sendAlert(String name, String json) {
    broker.alert(name, json);
  }
  public void sendEvent(StratconMessage m) {
    Event e = null;
    NoitMetricNumeric nmn = null;
    NoitMetricText nmt = null;
    NoitStatus ns = null;
    if (m instanceof NoitMetric) {
      NoitMetric nm = (NoitMetric)m;
      if(nm.isNumeric()) nmn = nm.getNumeric();
      if(nm.isText()) nmt = nm.getText();
    }
    else if (m instanceof NoitMetricNumeric) {
      nmn = (NoitMetricNumeric)m;
    }
    else if (m instanceof NoitMetricText) {
      nmt = (NoitMetricText)m;
    }
    else if (m instanceof NoitStatus) {
      ns = (NoitStatus)m;
    }
    if(nmn != null) {
      PersistentVector tags = PersistentVector.create(new java.lang.String[] {
                      "reconnoiter",
                      "check:" + nmn.getUuid(),
                      "name:" + nmn.getCheck_name(),
                      "module:" + nmn.getCheck_module(),
                      "noit:" + nmn.getNoit(),
                      "type:numeric" });
      e = new Event(nmn.getCheck_target(), // host
                    nmn.getName(), // service
                    null, // state
                    null, // description
                    nmn.getValue(), // value
                    tags, // tags
                    nmn.getTime()/1000, //time
                    10); //ttl
    }
    else if(nmt != null) {
      PersistentVector tags = PersistentVector.create(new java.lang.String[] {
                      "reconnoiter",
                      "check:" + nmt.getUuid(),
                      "name:" + nmt.getCheck_name(),
                      "module:" + nmt.getCheck_module(),
                      "noit:" + nmt.getNoit(),
                      "type:text" });
      e = new Event(nmt.getCheck_target(), // host
                    nmt.getName(), // service
                    null, // state
                    nmt.getMessage(), // description
                    null, // value
                    tags, // tags
                    nmt.getTime()/1000, //time
                    10); //ttl
    }
    if (ns != null) {
      PersistentVector tags = PersistentVector.create(new java.lang.String[] {
                    "reconnoiter",
                    "check:" + ns.getUuid(),
                    "name:" + ns.getCheck_name(),
                    "module:" + ns.getCheck_module(),
                    "noit:" + ns.getNoit(),
                    "availability:" + ns.getAvailability(),
                    "type:status" });
      e = new Event(ns.getCheck_target(), // host
                    "status", // service
                    ns.getState(), // state
                    ns.getStatus(), // description
                    ns.getDuration(), // value
                    tags, // tags
View Full Code Here

Examples of rinde.sim.event.Event

        addTickListener((TickListener) m);
      }
    }
    modelManager.configure();
    configured = true;
    dispatcher.dispatchEvent(new Event(SimulatorEventType.CONFIGURED, this));
  }
View Full Code Here

Examples of robocode.Event

      super.clear();
      return;
    }

    for (int i = 0; i < size(); i++) {
      Event e = get(i);

      if (!HiddenAccess.isCriticalEvent(e)) {
        remove(i--);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.