Package org.jredis.connector

Examples of org.jredis.connector.Connection$Event


   * TODO: monitor all connections and deal with faults
   */
  // ------------------------------------------------------------------------

  public void onEvent(Connection.Event event) {
    Connection conn = event.getSource();
    if(!connections.containsKey(conn)){
      throw new ProviderException("ClusterConnection receiving events for unrelated connection!");
    }
   
    // TODO: deal with it!
View Full Code Here


    initializeComponents();
  }

  final private void initializeConnections () throws ClientRuntimeException, ProviderException {
    for(ClusterNodeSpec nodeSpec : model.getSpec().getNodeSpecs()){
      Connection conn = null;
      if(getModality() == Connection.Modality.Synchronous){
        conn = notNull(createSynchConnection(nodeSpec), "", ProviderException.class);
      }
      else {
        conn = notNull(createAsynchConnection(nodeSpec), "", ProviderException.class);
View Full Code Here

  /**
     * @param nodeSpec
     * @return
     */
    protected Connection createSynchConnection (ClusterNodeSpec nodeSpec) {
      Connection conn = null;
      conn = new SynchConnection(nodeSpec.getConnectionSpec(), true);
      return conn;
    }
View Full Code Here

  // ------------------------------------------------------------------------

  public JRedisClient (ConnectionSpec connectionSpec){
    connectionSpec.setConnectionFlag(Connection.Flag.RELIABLE, Boolean.TRUE);
    connectionSpec.setConnectionFlag(Connection.Flag.SHARED, Boolean.FALSE);
    Connection syncConnection = createSyncConnection (connectionSpec);
    setConnection (syncConnection);
  }
View Full Code Here

   * @param redisVersion redis protocol compliance
   * @return
   */
  protected Connection createSyncConnection(ConnectionSpec connSpec){
    Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY);
    Connection   conn = null;
    try {
      conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class);
    }
    catch (ProviderException e) {
      Log.bug("Couldn't create the handler delegate.  => " + e.getLocalizedMessage());
View Full Code Here

  // ------------------------------------------------------------------------
  // Internal ops
  // ------------------------------------------------------------------------
  final private Connection createAsyncConnection() {
    Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY);
    Connection   conn = null;
    try {
      conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class);
    }
    catch (ProviderException e) {
      Log.bug("Couldn't create the handler delegate.  => " + e.getLocalizedMessage());
View Full Code Here

  /* (non-Javadoc) @see org.jredis.connector.Connection.Factory#newConnection(org.jredis.connector.ConnectionSpec) */
    public Connection newConnection (ConnectionSpec spec)
            throws ClientRuntimeException, NotSupportedException
    {
      Connection conn = null;
      switch (spec.getModality()){
      case Monitor:
        throw new ProviderException("NOT IMPLEMENTED!");
      case PubSub:
        throw new ProviderException("NOT IMPLEMENTED!");
View Full Code Here

   * per {@link ConnectionSpec} settings.
     * @param spec
     */
    private Connection newAsyncConnection (ConnectionSpec spec) {

      Connection conn = null;
      if(spec.getConnectionFlag(Flag.PIPELINE)){
      conn = new AsyncPipelineConnection(spec); // why not for all asyncs?
      }
      else {
        if(spec.getConnectionFlag(Flag.SHARED)){
View Full Code Here

  // ------------------------------------------------------------------------

  public JRedisClient (ConnectionSpec connectionSpec){
    // note: using a non shared connection mod
    connectionSpec.isReliable(true);
    Connection synchConnection = createSynchConnection (connectionSpec, false, RedisVersion.current_revision);
    setConnection (synchConnection);
  }
View Full Code Here

      {
         throw new NotYetImplemented("Need to support multiple events at once...");
      }

      // since we currently don't support sending multiple events to process at once, assume there's only one
      Event event = events.get(0);

      eventInvocation.setName(event.getName());
      eventInvocation.setPayload(PayloadUtils.getPayloadAsSerializable(event));

      // Extensions
      processExtensionsFrom(eventParams.getClass(), eventParams.getExtensions());
View Full Code Here

TOP

Related Classes of org.jredis.connector.Connection$Event

Copyright © 2018 www.massapicom. 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.