Package edu.emory.mathcs.backport.java.util.concurrent

Examples of edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap$HashIterator


    private Map lookupMap(Class entityClass) {
        Class prevalentClass = this.prevalenceInfo.getPrevalentClass(entityClass);
        if (prevalentClass != null) {
            Map entityMap = (Map) this.entitiesGlobalMap.get(prevalentClass);
            if (entityMap == null) {
                entityMap = new ConcurrentHashMap();
                this.entitiesGlobalMap.put(prevalentClass, entityMap);
            }
            return entityMap;
        } else {
            throw new PrevaylerConfigurationException("Object with no configured prevalent class: " + entityClass);
View Full Code Here


    public void init() throws Exception {
        if (configuration == null) {
            configuration = new HttpConfiguration();
        }
        managedContexts = new ConcurrentHashMap();
    }
View Full Code Here

                }
            } else {
                throw new IllegalStateException("No destination provided");
            }
        }
        pendingMessages = new ConcurrentHashMap();
        consumer = session.createConsumer(destination);
        consumer.setMessageListener(this);
    }
View Full Code Here

        this( timeToLive, DEFAULT_EXPIRATION_INTERVAL );
    }

    public ExpiringMap( int timeToLive, int expirationInterval )
    {
        this( new ConcurrentHashMap(), new CopyOnWriteArrayList(), timeToLive, expirationInterval );
    }
View Full Code Here

    /**
     * @return Returns the messages.
     */
    public Map getMessages() {
        if (messages == null) {
            messages = new ConcurrentHashMap();
        }
        return messages;
    }
View Full Code Here

    /**
     * @return Returns the properties.
     */
    public Map getProperties() {
        if (properties == null) {
            properties = new ConcurrentHashMap();
        }
        return properties;
    }
View Full Code Here

    protected void setProperties(Map properties) {
        this.properties = properties;
    }

    protected Map createPropertiesMap() {
        return new ConcurrentHashMap();
    }
View Full Code Here

    protected Map createPropertiesMap() {
        return new ConcurrentHashMap();
    }

    protected Map createAttachmentsMap() {
        return new ConcurrentHashMap();
    }
View Full Code Here

        //final int numMessages = 1;
        final int numMessages = NUM_MESSAGES;
        final SenderComponent sender = new SenderComponent();
        sender.setResolver(new ServiceNameEndpointResolver(ReceiverComponent.SERVICE));
        final Receiver receiver;
        final Map delivered = new ConcurrentHashMap();
        if (syncReceive) {
          receiver = new ReceiverComponent() {
              public void onMessageExchange(MessageExchange exchange) throws MessagingException {
                try {
                  if (delivered.get(exchange.getExchangeId()) == null) {
                      System.err.println("Message delivery rolled back: " + exchange.getExchangeId());
                    delivered.put(exchange.getExchangeId(), Boolean.TRUE);
                    tm.setRollbackOnly();
                    done(exchange);
                  } else {
                      System.err.println("Message delivery accepted: " + exchange.getExchangeId());
                    super.onMessageExchange(exchange);
                  }
              } catch (Exception e) {
                throw new MessagingException(e);
              }
              }
          };
        } else {
          receiver = new AsyncReceiverPojo() {
              public void onMessageExchange(MessageExchange exchange) throws MessagingException {
                try {
                  if (delivered.get(exchange.getExchangeId()) == null) {
                      System.err.println("Message delivery rolled back: " + exchange.getExchangeId());
                      delivered.put(exchange.getExchangeId(), Boolean.TRUE);
                    tm.setRollbackOnly();
                        exchange.setStatus(ExchangeStatus.DONE);
                        getContext().getDeliveryChannel().send(exchange);
                  } else {
                      System.err.println("Message delivery accepted: " + exchange.getExchangeId());
View Full Code Here

    private String queuePrefix = "queue.";
    private String topicPrefix = "topic.";

    public Context getInitialContext(Hashtable environment) throws NamingException {
        // lets create a factory
        Map data = new ConcurrentHashMap();
        String[] names = getConnectionFactoryNames(environment);
        for (int i = 0; i < names.length; i++) {
            ActiveMQConnectionFactory factory =null;
            String name = names[i];

            try{
             factory = createConnectionFactory(name, environment);
            }catch(Exception e){
                throw new NamingException("Invalid broker URL");

            }
       /*     if( broker==null ) {
                try {
                    broker = factory.getEmbeddedBroker();
                }
                catch (JMSException e) {
                    log.warn("Failed to get embedded broker", e);
                }
            }
       */
            data.put(name,factory);
        }

        createQueues(data, environment);
        createTopics(data, environment);
        /*
        if (broker != null) {
            data.put("destinations", broker.getDestinationContext(environment));
        }
        */
        data.put("dynamicQueues", new LazyCreateContext() {
            private static final long serialVersionUID = 6503881346214855588L;

            protected Object createEntry(String name) {
                return new ActiveMQQueue(name);
            }
        });
        data.put("dynamicTopics", new LazyCreateContext() {
            private static final long serialVersionUID = 2019166796234979615L;

            protected Object createEntry(String name) {
                return new ActiveMQTopic(name);
            }
View Full Code Here

TOP

Related Classes of edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap$HashIterator

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.