Simple caching in singleton DAO

Suppose I was to use a DAO like this in a web application. Different threads would be concurrently accessing this code from different servlets, struts actions, JSP pages, whatever.
import java.util.Map;
import java.util.HashMap;
public class CacheSingletonDAO {
     private static Map items = new HashMap();
     //----- Singleton Methods --------------------------------------------------
     private static final CacheSingletonDAO instance = new CacheSingletonDAO();
     private CacheSingletonDAO() {
          items.put("1","foo");
          items.put("2","bar");
     public static CacheSingletonDAO getInstance() {
          return instance;
     //----- Public Methods -----------------------------------------------------
     public String getItem(String key) {
          Object obj = items.get(key);
          if(obj != null && obj instanceof String) {
               return (String)obj;
          } else {
               return null;
     public Map getItems() {
          return items;
     public void addItem(String key, String item) {
          items.put(key,item);
}The code here is over simplified. For a real implementation of this, there would most likely be a private getItemsFromDB() method that the private constructor would call. I would also have a method like refreshCache() that would call the getItemsFromDB() method, so that I could call that to update the items HashMap with whatever is in the database. The addItem(String, String) method would first store the item in a database, then put item in the HashMap. Assume I would be using this in a single server, single JVM application. Are there any thread-safety or other problems/issues with code like this?

I don't think this logic necessarily follows. I agree
that the user must see all the entries in the
drop-down list, but that doesn't mean that this class
needs to hand the map over to the drop-down list
instance or the UI container. Instead, the UI could
ask this instance to write itself into the drop-down
list.I envisioned the DAO as the model in a MVC app. Writing the drop-down seems like it is a task for the view.
This is a very common sentiment among programmers.
"If you're code is written wrong, then it's not my
problem." I'm not saying that you're wrong to feel
this way, but in general projects get finished faster
when the interfaces between components or classes are
tight. That is, write an interface to your class
that helps people avoid coding mistakes. If
getItems().add() should not be coded then you should
try to make sure that it can't be.That makes sense.
This is a little better. Now when somebody else codes
getItems().add(), their code compiles (as it did
before) but when they run some test case (assuming
they test the right path) they will see an
UnsupportedOperationException instead of seeing some
occasional bad behaviour (as they would have seen
before). But better still, write an interface that
doesn't allow anybody else to code getItems().add() in
the first place. I'm not trying to make your life
more difficult, but in the long run doing this saves
time for everybody on your project.I see your point.
Would it be a reasonable
solution to write String[] getItemValues(), that
returns a copy of all the values currently in the
HashMap? Do you need to supply the user with key-value
pairs instead? Is there a way that you can return an
array of those things rather than the map?You are right, there is no reason I couldn't do that. Would this cause potential performance issues? I would think giving the client the a read-only reference to the hashmap would be faster than generating an array of Object each time.
>>
But then my original question still is do add and
refresh need to be synchronized? I can't think of
anything that would be bad if they weren't
synchronized, but maybe I am overlooking something.
What happens if someone calls the add method while
the refresh method is executing? I guess I need to
show more code to address that:
public void add(String key, String item) {
addItemToDB(key,item);
items.put(key.item);
public void refreshCache() {
items = getItemsFromDB();
}Assume addItemToDB() returns void and inserts myitem
into the database.
Assume getItemsFromDB() queries the DB for all the
items and returns a Map with all of the items.
Do these methods need to be synchronized?
You need to provide synchronization for the map, the
map has no synchronization of it's own.But just synchronizing add and refreshCache won't cut it, right? I think if things happend in this order I would have an issue:
1. Thread A calls refreshCache()
2. refreshCache() calls getItemsFromDB()
3. getItemsFromDB() internally has queried the DB, gotten a ResultSet and is building a collection from the result set, but the method isn't finished yet.
4. Thread B calls add()
5. add() calls addItemtoDB(key,item), which finishes
6. add() puts the item in the items HashMap
7. add() finished executing
8. getItemsFromDB() finishes executing and returns a collection, but the collection doesn't have the item add by Thread B's add()
9. refreshCache replaces the items HashMap with the collection returned from getItemsFromDB() and now the item that was added by Thread B's add() won't end up in the collection until next time refreshCache() is called.
This would be the case even if add() and refreshCache() were synchronized, right?

Similar Messages

  • Query for a simple caching mechanism

    Suppose that I have a CONTRACT table with 50000 records.
    I want to get the last inserted 100 records and then the next 100 and so on...
    In other words, like using a file pointer I want to get the next n records and then the next n records... Because I cannot load all the records in memory.
    I wrote a query with an IN clause and ROWNUM pseudo-column for the issue. But it doesn't result like i expected. Here is what it looks like:
    SELECT contract.contract_id
    FROM vw_contract contract
    WHERE ROWNUM <= 2
    AND contract.contract_date BETWEEN TO_DATE('03.01.2005','DD.MM.YYYY') AND TO_DATE('04.02.2005','DD.MM.YYYY')
    AND contract.contract_id NOT IN (SELECT k.contract_id
    FROM vv_yk_dp_contract c
    WHERE ROWNUM <= 2
    AND c.contract_date BETWEEN TO_DATE('03.01.2005','DD.MM.YYYY') AND TO_DATE('04.02.2005','DD.MM.YYYY'));
    To test it, I select the first 4 records. That query should give me the third and forth records but it doesn't. Also, the query is slow.
    Should I use a cursor? But, with PL/SQL how can a cursor be used for getting records between Nth and Mth?
    What kind of strategy should be used for such a simple caching issue?

    I want to get the last inserted 100 records and then the next 100 and so on...
    In other words, like using a file pointer I want to get the next n records and then >>the next n records...Something like this ? (But the solution depends on what kind of client you use).
    SQL> create or replace type t_varchar is table of varchar2(10)
      2  /
    Type created.
    SQL> create or replace package pkg1
      2  is
      3   cursor a is select ename from emp order by 1;
      4  end;
      5  /
    Package created.
    SQL> create or replace function get_rows
      2  return t_varchar
      3  pipelined
      4  is
      5   name emp.ename%type;
      6  begin
      7   if not pkg1.a%isopen then
      8    open pkg1.a;
      9   end if;
    10   loop
    11     fetch pkg1.a into name;
    12     exit when pkg1.a%notfound;
    13     pipe row(name);
    14   end loop;
    15   close pkg1.a;
    16   return;
    17  end;
    18  /
    Function created.
    SQL> select /* from 1 to 3th */ * from table(get_rows) where rownum <=3;
    COLUMN_VAL
    ADAMS
    ALLEN
    BLAKE
    SQL> select /* from 4th to 9th */ * from table(get_rows) where rownum <= 6;
    COLUMN_VAL
    CLARK
    FORD
    JAMES
    JONES
    KING
    MARTIN
    6 rows selected.
    SQL> select /* from 10th to 14th */ * from table(get_rows) where rownum <= 5;
    COLUMN_VAL
    MILLER
    SCOTT
    SMITH
    TURNER
    WARDRgds.

  • Can I Use Singletone  Pattren for DAO in Stateless EJB?

    Hi friends,
    I have a design in which i am creating an Business Layer using EJB (Stateless). In my case i have only read only to DataBase and at one case where i will be updating the database. But my application will be accessed by many concurrent users.
    My problem is if i create a DAO with singleton pattren then it will be returning the same instance to all the person who access the DB. So if one person is reading the database and at the same moment one more person request for update since the DAO is singleton object will there be any conflict?
    Reply soon

    Hi Martin.S
    Thanks for your suggestion.
    U Asked
    You need to think about why have you have made your DAO a Singleton. You need to ask yourself, SHOULD it be a Singleton? It may be valid decision but I find that doubtful. Singleton DAO's suit only limited set of circumstances. Why i decided to use singleton pattren was :
    Since i am using session bean and if i won't use Singleton pattren and
    If my app was used by say 1000 users
    Then 1000 Dao instaces whould be created!
    The App Server will have 1000 refrences which may be a performance issue and may slow down the server due to more usage of server resource. So i need to know weather is it a good idea to use the Singleton pattren for DAO when using SessionBeans?
    And one more doubt I have Martin
    If i use One Dao Class Per One Table Then How about the factories if i use singleton? Need to create so many factories as DAO's? *reply
    Also i think if i use Single DAO per Table and if i have say 1 user accessing the DAO and he is in the Middle of his execution and user 2 requests for the same DAO once again the situation is worse! Am i right?
    So I think Singleton pattren comes into handy only when one person is accessing the DAO at a time. After he completes then only we can give access to some one else.
    And also while Using EJB's Using syncronized DAO is not preffered since EJB's are for multiple access
    So do you have any solution for the same? Currently I am using ordinary DAO and creating multiple instances in the Session Bean.
    Is there any way to Use SingleTon Pattren inside SessionBean?
    Reply
    A Singleton DAO would be valid choice when you are doing performance/throughput optimisation for read only access to dataset which you have cached for speed, but need to ensure only one copy exists for memory efficiency.One more query martin,
    How can we use it for read only access to a data set?
    For example i have a DAO which queries and returns some result sets based on some input value given by the user
    Now take a senario1: User1 supplys some input value and executes method1() and he is in the middle.
    User2 comes in and acess the same method1() with different input value
    Since it is a SingleTon Pattren The User2 will get same refrence
    So user1 will get the result set that is having the input parameters of user2. Right?????????
    So my inference is we cannot use singelton pattren for concurrent acess of the DAO.What do you say
    Please Reply Martin

  • InitialContext caching previous lookups?

    Weblogic 6.1 SP3
    Currently, all of our beans lookup the homes of other beans they need in the ejbCreate
    method. Our session beans lookup entity beans in their ejbCreate methods. Some
    of these session beans use the same entity beans and I think it is inefficient
    to have different session beans lookup the same entity beans multiple times.
    I designed a simple Service Locator singleton in my server. Basically, in the
    Session Bean's ejbCreate, the home is taken from the Service Locator's cache.
    If the Service Locator doesn't have the home in cache, it creates it. Therefore,
    if I have 10 session beans looking up the same entity bean, the bean will only
    be looked up once instead of 10 times.
    I did some timing tests and found that the optimization really didn't improve
    the performance at all.
    Therefore, I'm wondering if Weblogic is doing any caching of previously looked
    up homes in their implementation of the InitialContext. Does anyone know if Weblogic
    is doing this?
    Thanks.
    Dan

    Why not DataSources ?
    "Doug Larson" <[email protected]> wrote in message
    news:[email protected]..
    >
    I am caching the results (except the DataSources...), but I'd like toreuse the
    InitialContext across calls so I dont need to call new InitialContext()for each
    lookup.
    Any advise?
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Since the lookups are expensive (in 6.x and 7.0), I think that you'll
    be
    better off caching lookup results.
    "Doug Larson" <[email protected]> wrote in message
    news:[email protected]..
    I seem to be unable to find a best practice for caching InitialContextobjects.
    I'm doing some profile on my current project to pinpoint hotspots foroptimizations
    and the creation of IC seems to be one of those areas.
    Is it recommended to use a singleton approach to InitialContext?
    How about an object pool?
    Or an instance per object for internal reuse?
    Will an IC object ever be invalidated (will I need to recreate theobject
    under
    certain circumstances?)
    Any feedback is appreciated.
    Thanks,
    Doug--
    Dimitri
    Dimitri

  • MDB and Singleton

    I have a MDB that receives data from a JSM queue in XML format. After converting the XML to proper Value Objects using JAXB, it calls a DAO.
    We have configure the App server (WLS 8.1)to have 10 MDB in the pool.
    The DAO is a singleton with a none static private data member that holds the DataSource.
    The DAO.add() operation gets connection from the data source and performs the add.
    When we put one msg on the JMS queue we see the transaction time in DAO.add() is an about 1 sec.
    When we put 30 msgs on the JMS queue we see 10 threads accessing the singleton instance of the DAO.
    I was hoping to see the DB transactions started by these 10 threads would be executed in parallel they way threaded operations should behave considering the context switching factor however what I am seeing from the log files is that the DB transactions are serialized meaning they get executed one at a time!!?? Therefore it takes 10 sec for the 10 threads to complete their work. I was expecting to see something like 3 to 4 sec for all 10 thread to complete the add operation.
    Anyone has any ideas? Could it be that the Datasource is a private member of the Singleton DAO and each thread who calls the DAO.add() gets queued up to get access to the Data Source?
    Any idea would be great.
    Thanks.

    Thanks for your answer,
    So you never load classes then from configuration file? For example lets say you are processing xml message and for each xml message tag name you have in configuration file the appropriate class to handle such a message. Instead of configuration files would you then just store the values in a map of messageTagName to JNDI name?
    Thanks
    http://www.ellasweddingfavors.com
    Message was edited by:
    fkzeljo
    Ellas Wedding Favors

  • Cache distribution - Java object cache

    Hi.
    I'm trying to use Oracle Java Object Cache (cache.jar), the one included in the 9iAS 9.0.3.
    Everything works fine but the cache distribution between different JVM:s.
    Anyone got this to work?
    Regards
    Jesper
    package test;
    import oracle.ias.cache.*;
    * Singleton Cache class.
    public class Cache {
         /** The singleton instance of the object. */
         private static Cache instance = null;
         /** The root region. */
         private final static String APP_NAME = "Test";
         * Protected constructor - Use <code>getInstance()</code>.
         * @throws Exception if error
         protected Cache() throws Exception {
              CacheAccess.defineRegion(APP_NAME);
         * Gets the singleton instance.
         * @return The instance of the Cache object.
         public static Cache getInstance() throws Exception {
              if (instance==null) {
                   createInstance();
              return instance;
         * Creates the singleton instance in a thread-safe manner.
         synchronized private static void createInstance() throws Exception {
              if (instance==null) {
                   instance = new Cache();
         * Put an object on the cache.
         * @param name The object name
         * @param subRegion The sub region
         * @param object The object to cache
         * @throws Exception if error
         public static void put(String name, String subRegion, Object object) throws Exception {
              CacheAccess appAcc = null;
              CacheAccess subAcc = null;
              try {
                   appAcc = CacheAccess.getAccess(APP_NAME);
                   // Create a group
                   Attributes a = new Attributes();
                   a.setFlags(Attributes.DISTRIBUTE);
                   appAcc.defineSubRegion(subRegion, a);
                   subAcc = appAcc.getSubRegion(subRegion);
                   if (!subAcc.isPresent(name)) {
                        subAcc.put(name, a, object);
                   } else {
                        subAcc.replace(name, object);
              } catch (CacheException ex){
                   // handle exception
                   System.out.println(ex.toString());
              } finally {
                   if (subAcc != null) {
                        subAcc.close();
                   if (appAcc != null) {
                        appAcc.close();
         * Gets a cached object from the specified sub region
         * @param name The object name
         * @param subRegion The sub region
         * @return The cached object
         * @throws Exception if requested object not in cache
         public static Object get(String name, String subRegion) throws Exception {
              CacheAccess appAcc = null;
              CacheAccess subAcc = null;
              Object result = null;
              try {
                   appAcc = CacheAccess.getAccess(APP_NAME);
                   subAcc = appAcc.getSubRegion(subRegion);
                   // define an object and set its attributes
                   result = (Object)subAcc.get(name);
              } catch (CacheException ex){
                   // handle exception
                   throw new Exception("Object '" + name + "' not in cache region '" + subAcc.getRegionName() + "'.");
              } finally {
                   if (subAcc != null) {
                        subAcc.close();
                   if (appAcc != null) {
                        appAcc.close();
              return result;
         * Invalidates all objects in all regions
         public static void invalidateAll() throws Exception {
              CacheAccess appAcc = CacheAccess.getAccess(APP_NAME);
              appAcc.invalidate(); // invalidate all objects
              appAcc.close(); // close the CacheAccess access
         // Main method for testing purposes.
         public static void main(String[] args) throws Exception {
              try {
                   System.out.println(">> Caching object OBJ1 into region TEST1.");
                   Cache.getInstance().put("OBJ1", "TEST1", "Object cached in TEST1.");
                   System.out.println(">> Getting OBJ1 from cache region TEST1.");
                   System.out.println(Cache.getInstance().get("OBJ1", "TEST1"));
              } catch (Exception ex) {
                   System.out.println(ex.getMessage());
    Contents of JAVACACHE.PROPERTIES:
    # discoveryAddress is a list of cache servers and ports
    discoveryAddress = host1.myserver.com:12345,host2.myserver.com:12345
    logFileName = c:\javacache.log
    logSeverity = DEBUG
    distribute = true

    I have same problem
    Exist some reason?
    I'm testing Cache with isDistributed() method and I still got false!
    Thanx

  • Implementing cache for dropdown values in Web Dynpro Iview

    Hi All,
             I am currently in the processing of enhancing a web dynpro application which contains among other things around 15 drop down boxes. The values in these drop down boxes are coming from oracle database and these values change occasionally.
            To optimize the response time, I have implemented simple caching machanism using static  variable in plain java class. The objective is to retrieve the values for the first time from oracle db and use the same datastructure for subsequent calls. Though I have found that the number of calls to the database reduced significantly I am facing some problem understanding and implementing the cache refresh behaviour.
          I want to implement a cache refresh machanism for every 12 hours.
        Solutions tried.
                   Creating a thread to refresh the cache for every 12 hours.
                   Creating a timer for refreshing the cache for every 12 hours.
        Problems encountered :
        1.  Is it appropriate to use threads in a web dynpro app?
        2.  What I have observed is that  the thread (I have created a daemon thread) is alive even after I have deployed a new copy of the code.  When I deploy a new code is it not supposed to remove all copies from the memory?
           If using a daemon thread is appropriate, What is the web dynpro
              framework's class loading behavior when a new copy of code is deployed?
             Does it completely unload existing classes (there by killing the daemon thread
                   created in previous deployment)?
       3. Assuming that we have found suitable solution for thread issues, what would  happen when the application is deployed on a cluster? Can we send a message to
            all the nodes in the cluster?
    I would like to understand what other developers has done in these kind of situations. Your experience and insight will be valuable and help me decide to implement caching or not in  the first place.   
    Thanks in advance.
    Regards
    Pallayya Batchu

    Pallayya,
    <i>1. Is it appropriate to use threads in a web dynpro app?</i>
    Not recommended as with any J2EE application
    <i>2. What I have observed is that the thread (I have created a daemon thread) is alive even after I have deployed a new copy of the code. When I deploy a new code is it not supposed to remove all copies from the memory?</i>
    Re-deployment doesn't mean stopping all user spawned threads. It just causes unloading of classes if there are no hard references from anything but deployed application. In your case, there are probably references from Thread/Runnable so your previous version is not unloaded on redeployment.
    <i>3. Assuming that we have found suitable solution for thread issues, what would happen when the application is deployed on a cluster? Can we send a message to all the nodes in the cluster?</i>
    Probably you can, probably you cannot. Even if you can it would be complex.
    My advise -- abandon threads altogether, use real cache instead:
    package com.yourcompany.yourapp.utils;
    import java.util.HashMap;
    import java.util.Map;
    public class ValueHelpCache {
      private static class Entry {
        long lastLoadTime;
        Map  payload;
        Entry(final Map payload) {
          this.payload = payload;
          this.lastLoadTime = System.currentTimeMillis();
      final private Map _entries = new HashMap();
      private ValueHelpCache() {}
      synchronized public Map getValueHelp(final String valuyeHelpKey) {
         Entry entry = (Entry)_entries.get(valuyeHelpKey);
         if ( entry == null) {
           entry = new Entry( loadValueHelpFromDatabase(valuyeHelpKey) );
           _entries.put(valuyeHelpKey, entry);
         } else {
           final long now = System.currentTimeMillis();
           if ( now - entry.lastLoadTime > ENTRY_TTL ) {
             entry.payload = loadValueHelpFromDatabase(valuyeHelpKey);
             entry.lastLoadTime = now;
        return entry.payload;
      private Map loadValueHelpFromDatabase(final String valuyeHelpKey) {
        /* @TODO implement loading values from database */
        return null;
      public static ValueHelpCache getInstance() { return INSTANCE; }
      final public static long ENTRY_TTL = 12 * 60 * 60 * 1000;
      final private static ValueHelpCache INSTANCE = new ValueHelpCache();
    This way client code tracks itself what entries are stale and need to be reloaded. No threads at all and no problems in cluster. You may alter time tracking mechanism to reload at given time of day, say at 12AM and 12PM -- just use java.util.Calendar and change code accordingly.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • Proxy cache

    Hello,
    I am having problems with a programming assignment. It's a proxy cache assignment, code has been written and I need to fill in the blanks, but I am confused on how to start.
    Here's the Proxy cache code
    * ProxyCache.java - Simple caching proxy
    * $Id: ProxyCache.java,v 1.3 2004/02/16 15:22:00 kangasha Exp $
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class ProxyCache {
        /** Port for the proxy */
        private static int port;
        /** Socket for client connections */
        private static ServerSocket socket;
        /** Create the ProxyCache object and the socket */
        public static void init(int p) {
         port = p;
         try {
             socket = /* Fill in */;
         } catch (IOException e) {
             System.out.println("Error creating socket: " + e);
             System.exit(-1);
        public static void handle(Socket client) {
         Socket server = null;
         HttpRequest request = null;
         HttpResponse response = null;
         /* Process request. If there are any exceptions, then simply
          * return and end this request. This unfortunately means the
          * client will hang for a while, until it timeouts. */
         /* Read request */
         try {
             BufferedReader fromClient = /* Fill in */;
             request = /* Fill in */;
         } catch (IOException e) {
             System.out.println("Error reading request from client: " + e);
             return;
         /* Send request to server */
         try {
             /* Open socket and write request to socket */
             server = /* Fill in */;
             DataOutputStream toServer = /* Fill in */;
             /* Fill in */
         } catch (UnknownHostException e) {
             System.out.println("Unknown host: " + request.getHost());
             System.out.println(e);
             return;
         } catch (IOException e) {
             System.out.println("Error writing request to server: " + e);
             return;
         /* Read response and forward it to client */
         try {
             DataInputStream fromServer = /* Fill in */;
             response = /* Fill in */;
             DataOutputStream toClient = /* Fill in */;
             /* Fill in */
             /* Write response to client. First headers, then body */
             client.close();
             server.close();
             /* Insert object into the cache */
             /* Fill in (optional exercise only) */
         } catch (IOException e) {
             System.out.println("Error writing response to client: " + e);
        /** Read command line arguments and start proxy */
        public static void main(String args[]) {
         int myPort = 0;
         try {
             myPort = Integer.parseInt(args[0]);
         } catch (ArrayIndexOutOfBoundsException e) {
             System.out.println("Need port number as argument");
             System.exit(-1);
         } catch (NumberFormatException e) {
             System.out.println("Please give port number as integer.");
             System.exit(-1);
         init(myPort);
         /** Main loop. Listen for incoming connections and spawn a new
          * thread for handling them */
         Socket client = null;
         while (true) {
             try {
              client = /* Fill in */;
              handle(client);
             } catch (IOException e) {
              System.out.println("Error reading request from client: " + e);
              /* Definitely cannot continue processing this request,
               * so skip to next iteration of while loop. */
              continue;
    }

    And the HTTPRequest code
    * HttpRequest - HTTP request container and parser
    * $Id: HttpRequest.java,v 1.2 2003/11/26 18:11:53 kangasha Exp $
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class HttpRequest {
        /** Help variables */
        final static String CRLF = "\r\n";
        final static int HTTP_PORT = 80;
        /** Store the request parameters */
        String method;
        String URI;
        String version;
        String headers = "";
        /** Server and port */
        private String host;
        private int port;
        /** Create HttpRequest by reading it from the client socket */
        public HttpRequest(BufferedReader from) {
         String firstLine = "";
         try {
             firstLine = from.readLine();
         } catch (IOException e) {
             System.out.println("Error reading request line: " + e);
         String[] tmp = firstLine.split(" ");
         method = "GET";
         URI = "HTTP/";
         version = "1.1";
         System.out.println("URI is: " + URI);
         if (!method.equals("GET")) {
             System.out.println("Error: Method not GET");
         try {
             String line = from.readLine();
             while (line.length() != 0) {
              headers += line + CRLF;
              /* We need to find host header to know which server to
               * contact in case the request URI is not complete. */
              if (line.startsWith("Host:")) {
                  tmp = line.split(" ");
                  if (tmp[1].indexOf(':') > 0) {
                   String[] tmp2 = tmp[1].split(":");
                   host = tmp2[0];
                   port = Integer.parseInt(tmp2[1]);
                  } else {
                   host = tmp[1];
                   port = HTTP_PORT;
              line = from.readLine();
         } catch (IOException e) {
             System.out.println("Error reading from socket: " + e);
             return;
         System.out.println("Host to contact is: " + host + " at port " + port);
        /** Return host for which this request is intended */
        public String getHost() {
         return host;
        /** Return port for server */
        public int getPort() {
         return port;
         * Convert request into a string for easy re-sending.
        public String toString() {
         String req = "";
         req = method + " " + URI + " " + version + CRLF;
         req += headers;
         /* This proxy does not support persistent connections */
         req += "Connection: close" + CRLF;
         req += CRLF;
         return req;
    }HTTPResponse code
    * HttpResponse - Handle HTTP replies
    * $Id: HttpResponse.java,v 1.2 2003/11/26 18:12:42 kangasha Exp $
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class HttpResponse {
        final static String CRLF = "\r\n";
        /** How big is the buffer used for reading the object */
        final static int BUF_SIZE = 8192;
        /** Maximum size of objects that this proxy can handle. For the
         * moment set to 100 KB. You can adjust this as needed. */
        final static int MAX_OBJECT_SIZE = 100000;
        /** Reply status and headers */
        String version;
        int status;
        String statusLine = "";
        String headers = "";
        /* Body of reply */
        byte[] body = new byte[MAX_OBJECT_SIZE];
        /** Read response from server. */
        public HttpResponse(DataInputStream fromServer) {
         /* Length of the object */
         int length = -1;
         boolean gotStatusLine = false;
         /* First read status line and response headers */
         try {
             String line = /* Fill in */;
             while (line.length() != 0) {
              if (!gotStatusLine) {
                  statusLine = line;
                  gotStatusLine = true;
              } else {
                  headers += line + CRLF;
              /* Get length of content as indicated by
               * Content-Length header. Unfortunately this is not
               * present in every response. Some servers return the
               * header "Content-Length", others return
               * "Content-length". You need to check for both
               * here. */
              if (line.startsWith("GET") ||
                  line.startsWith("HTTP/1.1")) {
                  String[] tmp = line.split(" ");
                  length = Integer.parseInt(tmp[1]);
              line = fromServer.readLine();
         } catch (IOException e) {
             System.out.println("Error reading headers from server: " + e);
             return;
         try {
             int bytesRead = 0;
             byte buf[] = new byte[BUF_SIZE];
             boolean loop = false;
             /* If we didn't get Content-Length header, just loop until
              * the connection is closed. */
             if (length == -1) {
              loop = true;
             /* Read the body in chunks of BUF_SIZE and copy the chunk
              * into body. Usually replies come back in smaller chunks
              * than BUF_SIZE. The while-loop ends when either we have
              * read Content-Length bytes or when the connection is
              * closed (when there is no Connection-Length in the
              * response. */
             while (bytesRead < length || loop) {
              /* Read it in as binary data */
              int res = /* Fill in */;
              if (res == -1) {
                  break;
              /* Copy the bytes into body. Make sure we don't exceed
               * the maximum object size. */
              for (int i = 0;
                   i < res && (i + bytesRead) < MAX_OBJECT_SIZE;
                   i++) {
                  /* Fill in */
              bytesRead += res;
         } catch (IOException e) {
             System.out.println("Error reading response body: " + e);
             return;
         * Convert response into a string for easy re-sending. Only
         * converts the response headers, body is not converted to a
         * string.
        public String toString() {
         String res = "";
         res = statusLine + CRLF;
         res += headers;
         res += CRLF;
         return res;
    }

  • CAN I DO DATA CACHING by JAVA BEAN persistence?

    I need to keep Objects cached in the server side. so in order to make it persistence can i use JAVA BEANS.
    I am not interested to do for EJB.
    I need a cache component build in the server side .
    how can i do it in JAVA / J2EE platform?

    Your cache doesn't necessarily need to be persistant unless you're doing something like calculating the size or keeping it between server restarts.
    A simple cache is very easy to do but can get quite complex very quickly. Search for Caching on javaworld.com there's a pretty good article on it there.
    Also take a look for JCache on jcp.org, it's a request for a cacheing spec to be built into Java. Some interesting stuff there.
    Basically all you need is a HashMap to hold, keys and objects.

  • Weak and concurrent hash map for caching

    Hello,
    I have written a very simple cache class with both weakness and concurrency benefits. This class is intended to be used as a weak cache in "hot redeploy" capable servers (JBoss or any other).
    My implementation uses the (problematic) "double-check" pattern with a reentrant lock and encapsulates a WeakHashMap with WeakReference values (to avoid circular key/value references). Here is the code:
    public interface ValueCreator<V> {
         public V create();
    public class WeakCache<K, V> {
         private final Lock lock = new ReentrantLock();
         private final Map<K, WeakReference<V>> weakMap;
         public WeakCache() {
              this(16);
         public WeakCache(int initialCapacity) {
              this(initialCapacity, 0.75F);
         public WeakCache(int initialCapacity, float loadFactor) {
              weakMap = new WeakHashMap<K, WeakReference<V>>(initialCapacity, loadFactor);
         public V get(K key, ValueCreator<V> creator) {
              WeakReference<V> ref = weakMap.get(key);
              if (ref == null) {
                   lock.lock();
                   try {
                        ref = weakMap.get(key);
                        if (ref == null) {
                             ref = new WeakReference<V>(creator.create());
                             weakMap.put(key, ref);
                   } finally {
                        lock.unlock();
              return ref.get();
         }One usage of this cache is for session ejb3 lookup:
    private static final WeakCache<Class, Object> LOOKUP_CACHE = new WeakCache<Class, Object>();
    public static <T> T lookup(final Class<T> serviceClass) {
         T service = (T)LOOKUP_CACHE.get(serviceClass,
              new ValueCreator<Object>() {
                   public T create() {
                        String lookup = "myapp/" + serviceClass.getSimpleName() + "/local";
                        try {
                             return (T)(new InitialContext()).lookup(lookup);
                        } catch (NamingException e) {
                             throw new RuntimeException("Could not lookup EJB " + serviceClass + ": " + lookup, e);
         return service;
    ...2 questions:
    1. Is there any issue with concurrent access to this cache ?
    2. What happens exactly when the garbage collector wants to free memory with a map with both weak keys and values ?
    Some limited tests show that the behavior of this cache fits my needs: the lookup cache is cleared on redeploy and it keeps its key/values pairs otherwise.
    Thanks for any comments.
    Message was edited by:
    fwolff999

    I know that DCL is broken under certain circumstances (but I have read it may work with modern JVM and the use of volatile variables for example).
    So: is it broken with this specific implementation and if so, what should be done to make it work ?
    The getter method is potentially setting a value (like in ConcurrentHashMap.putIfAbsent) and it uses a ValueCreator in order to actually create the value only if it is not already present in the map.

  • How to cache objects?

    Hi,
    I have an application that connects to a database using JDBC. It basically implements JSR-170 and what I want to do is to be able to cache the objects so that I don't have to make a trip to the database everytime. How can I accomplish this? I looked into java object caching but it looks like I would still need to do a lot on my side - first, to cache the objects and then, to retrieve them using an index. If I want to store the objects for a tree hierarchy and for multiple users, what would I need to do?
    Thanks.

    For a simple cache, you might do a google for objectcache.java. This will give you some idea of what a cache does and how it's coded.
    I have no idea what you mean by 'retrieve them using an index'. If you want to cache a tree heirarchy, you might cache DefaultMutableTreeNodes. I'm not sure what you mean by multiple users. Are you talking about server side processing?

  • Spring with coherence cache deploy issue

    hi, i configured spring with coherence cachestore, and i make s a sample example on that, load some value based key, if key not there in cache it automatically callbacks call to cachestore load(Object key) and ge5t value from db and put in cache........this application work in standardlone but if make web application application deploy time this error coming............
    log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    2013-10-10 16:05:09.528/1.279 Oracle Coherence 3.7.1.1 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/D:/m2repo/org/tangosol/net/coherence/3.7/coherence-3.7.jar!/tangosol-coherence.xml"
    2013-10-10 16:05:09.559/1.310 Oracle Coherence 3.7.1.1 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/D:/m2repo/org/tangosol/net/coherence/3.7/coherence-3.7.jar!/tangosol-coherence-override-dev.xml"
    2013-10-10 16:05:09.591/1.342 Oracle Coherence 3.7.1.1 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/D:/travererpibeproject/test/cnk-test-caching-web/src/main/webapp/WEB-INF/lib/cnk-common-caching-1.0.0-SNAPSHOT.jar!/tangosol-coherence-override.xml"
    2013-10-10 16:05:09.591/1.342 Oracle Coherence 3.7.1.1 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
    Oracle Coherence Version 3.7.1.1 Build 28901
    Grid Edition: Development mode
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    2013-10-10 16:05:09.700/1.451 Oracle Coherence GE 3.7.1.1 <Info> (thread=main, member=n/a): Loaded cache configuration from "jar:file:/D:/travererpibeproject/test/cnk-test-caching-web/src/main/webapp/WEB-INF/lib/cnk-common-caching-1.0.0-SNAPSHOT.jar!/coherence-cache-config.xml"; this document does not refer to any schema definition and has not been validated.
    cache service
    2013-10-10 16:05:10.423/2.174 Oracle Coherence GE 3.7.1.1 <D4> (thread=main, member=n/a): TCMP bound to /10.21.12.29:8088 using SystemSocketProvider
    2013-10-10 16:05:41.297/33.048 Oracle Coherence GE 3.7.1.1 <Info> (thread=Cluster, member=n/a): Created a new cluster "CoherenceCluster" with Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=2) UID=0x0A150C1D00000141A1EF3564729A1F98
    2013-10-10 16:05:41.297/33.048 Oracle Coherence GE 3.7.1.1 <Info> (thread=main, member=n/a): Started cluster Name=CoherenceCluster
    Group{Address=231.1.1.1, Port=7777, TTL=3}
    MasterMemberSet(
      ThisMember=Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner)
      OldestMember=Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner)
      ActualMemberSet=MemberSet(Size=1
        Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner)
      MemberId|ServiceVersion|ServiceJoined|MemberState
        1|3.7.1|2013-10-10 16:05:41.297|JOINED
      RecycleMillis=1200000
      RecycleSet=MemberSet(Size=0
    TcpRing{Connections=[]}
    IpMonitor{AddressListSize=0}
    2013-10-10 16:05:41.329/33.080 Oracle Coherence GE 3.7.1.1 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1
    2013-10-10 16:05:41.548/33.299 Oracle Coherence GE 3.7.1.1 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1
    2013-10-10 16:10:16.093/307.844 Oracle Coherence GE 3.7.1.1 <Error> (thread=Cluster, member=1): Detected soft timeout) of {WrapperGuardable Guard{Daemon=DistributedCache} Service=PartitionedCache{Name=DistributedCache, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}}
    2013-10-10 16:10:16.093/307.844 Oracle Coherence GE 3.7.1.1 <Error> (thread=Recovery Thread, member=1): Full Thread Dump
    Thread[Logger@9254847 3.7.1.1,3,main]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Attach Listener,5,system]
    Thread[Signal Dispatcher,9,system]
    Thread[ReaderThread,5,main]
        java.net.SocketInputStream.socketRead0(Native Method)
        java.net.SocketInputStream.read(SocketInputStream.java:150)
        java.net.SocketInputStream.read(SocketInputStream.java:121)
        sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
        sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
        sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
        java.io.InputStreamReader.read(InputStreamReader.java:184)
        java.io.BufferedReader.fill(BufferedReader.java:154)
        java.io.BufferedReader.readLine(BufferedReader.java:317)
        java.io.BufferedReader.readLine(BufferedReader.java:382)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner$ReaderThread.run(RemoteTestRunner.java:140)
    Thread[Invocation:Management:EventDispatcher,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.onWait(Service.CDB:7)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Invocation:Management,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.Service.onWait(Service.CDB:4)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onWait(Grid.CDB:3)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketReceiver,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketReceiver.onWait(PacketReceiver.CDB:2)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Cluster|Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner),5,Cluster]
        sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
        sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:295)
        sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:277)
        sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:158)
        sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
        sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
        com.tangosol.coherence.component.net.TcpRing.select(TcpRing.CDB:11)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onWait(ClusterService.CDB:6)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Reference Handler,10,system]
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Object.java:503)
        java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
    Thread[DistributedCache,10,Cluster]
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:184)
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:237)
        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        com.cnk.travelerp.common.caching.service.SpringAwareCacheFactory.instantiateAny(SpringAwareCacheFactory.java:161)
        com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:3324)
        com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1753)
        com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1500)
        com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:4111)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.instantiateBackingMap(PartitionedCache.CDB:23)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.setCacheName(PartitionedCache.CDB:25)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ServiceConfig$ConfigListener.entryInserted(PartitionedCache.CDB:17)
        com.tangosol.util.MapEvent.dispatch(MapEvent.java:266)
        com.tangosol.util.MapEvent.dispatch(MapEvent.java:226)
        com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:567)
        com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
        com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
        com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
        com.tangosol.coherence.component.util.ServiceConfig$Map.put(ServiceConfig.CDB:43)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$StorageIdRequest.onReceived(PartitionedCache.CDB:45)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:34)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:33)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[Recovery Thread,5,Cluster]
        java.lang.Thread.dumpThreads(Native Method)
        java.lang.Thread.getAllStackTraces(Thread.java:1618)
        com.tangosol.net.GuardSupport.logStackTraces(GuardSupport.java:810)
        com.tangosol.internal.net.cluster.DefaultServiceFailurePolicy.onGuardableRecovery(DefaultServiceFailurePolicy.java:44)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$WrapperGuardable.recover(Grid.CDB:1)
        com.tangosol.net.GuardSupport$Context$1.run(GuardSupport.java:653)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketListenerN,10,Cluster]
        java.net.TwoStacksPlainDatagramSocketImpl.receive0(Native Method)
        java.net.TwoStacksPlainDatagramSocketImpl.receive(TwoStacksPlainDatagramSocketImpl.java:90)
        java.net.DatagramSocket.receive(DatagramSocket.java:786)
        com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
        com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketPublisher,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.onWait(PacketPublisher.CDB:2)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketListener1P,10,Cluster]
        java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
        java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:105)
        java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
        java.net.DatagramSocket.receive(DatagramSocket.java:786)
        com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
        com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[main,5,main]
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Object.java:503)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.poll(Grid.CDB:26)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.poll(Grid.CDB:11)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.ensureCache(PartitionedCache.CDB:29)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.ensureCache(PartitionedCache.CDB:36)
        com.tangosol.coherence.component.util.safeService.SafeCacheService.ensureCache$Router(SafeCacheService.CDB:1)
        com.tangosol.coherence.component.util.safeService.SafeCacheService.ensureCache(SafeCacheService.CDB:33)
        com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:920)
        com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(DefaultConfigurableCacheFactory.java:1296)
        com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:297)
        com.tangosol.net.CacheFactory.getCache(CacheFactory.java:204)
        com.tangosol.net.CacheFactory.getCache(CacheFactory.java:181)
        com.cnk.travelerp.common.caching.service.CacheService.<init>(CacheService.java:36)
        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
        org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735)
        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
        org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
        org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
        org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
        org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
        org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
        org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
        org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
        org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
        org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
        org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
        org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
        org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
        org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
        org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
        org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Thread[PacketListener1,10,Cluster]
        java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
        java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:105)
        java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
        java.net.DatagramSocket.receive(DatagramSocket.java:786)
        com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
        com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[IpMonitor,6,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.IpMonitor.onWait(IpMonitor.CDB:4)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketSpeaker,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.queue.ConcurrentQueue.waitForEntry(ConcurrentQueue.CDB:16)
        com.tangosol.coherence.component.util.queue.ConcurrentQueue.remove(ConcurrentQueue.CDB:7)
        com.tangosol.coherence.component.util.Queue.remove(Queue.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketSpeaker.onNotify(PacketSpeaker.CDB:21)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[Finalizer,8,system]
        java.lang.Object.wait(Native Method)
        java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
        java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
        java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)
    2013-10-10 16:10:16.093/307.844 Oracle Coherence GE 3.7.1.1 <Warning> (thread=Recovery Thread, member=1): Attempting recovery of Guard{Daemon=DistributedCache}
    2013-10-10 16:10:46.607/338.358 Oracle Coherence GE 3.7.1.1 <Error> (thread=Cluster, member=1): Detected hard timeout) of {WrapperGuardable Guard{Daemon=DistributedCache} Service=PartitionedCache{Name=DistributedCache, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}}
    2013-10-10 16:10:46.607/338.358 Oracle Coherence GE 3.7.1.1 <Error> (thread=Termination Thread, member=1): Full Thread Dump
    Thread[Logger@9254847 3.7.1.1,3,main]
        java.io.FileOutputStream.writeBytes(Native Method)
        java.io.FileOutputStream.write(FileOutputStream.java:318)
        java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
        java.io.PrintStream.write(PrintStream.java:480)
        sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
        sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
        sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
        java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
        java.io.PrintStream.write(PrintStream.java:527)
        java.io.PrintStream.print(PrintStream.java:669)
        java.io.PrintStream.println(PrintStream.java:806)
        com.tangosol.coherence.component.util.logOutput.Standard.log(Standard.CDB:9)
        com.tangosol.coherence.component.util.logOutput.Standard.log(Standard.CDB:1)
        com.tangosol.coherence.component.util.LogOutput.log(LogOutput.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.Logger.onNotify(Logger.CDB:99)
        com.tangosol.coherence.component.application.console.Coherence$Logger.onNotify(Coherence.CDB:4)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[Attach Listener,5,system]
    Thread[Signal Dispatcher,9,system]
    Thread[ReaderThread,5,main]
        java.net.SocketInputStream.socketRead0(Native Method)
        java.net.SocketInputStream.read(SocketInputStream.java:150)
        java.net.SocketInputStream.read(SocketInputStream.java:121)
        sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
        sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
        sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
        java.io.InputStreamReader.read(InputStreamReader.java:184)
        java.io.BufferedReader.fill(BufferedReader.java:154)
        java.io.BufferedReader.readLine(BufferedReader.java:317)
        java.io.BufferedReader.readLine(BufferedReader.java:382)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner$ReaderThread.run(RemoteTestRunner.java:140)
    Thread[Termination Thread,5,Cluster]
        java.lang.Thread.dumpThreads(Native Method)
        java.lang.Thread.getAllStackTraces(Thread.java:1618)
        com.tangosol.net.GuardSupport.logStackTraces(GuardSupport.java:810)
        com.tangosol.internal.net.cluster.DefaultServiceFailurePolicy.onGuardableTerminate(DefaultServiceFailurePolicy.java:80)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$WrapperGuardable.terminate(Grid.CDB:1)
        com.tangosol.net.GuardSupport$Context$2.run(GuardSupport.java:677)
        java.lang.Thread.run(Thread.java:722)
    Thread[Invocation:Management:EventDispatcher,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.onWait(Service.CDB:7)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Invocation:Management,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.Service.onWait(Service.CDB:4)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onWait(Grid.CDB:3)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketReceiver,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketReceiver.onWait(PacketReceiver.CDB:2)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Cluster|Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner),5,Cluster]
        sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
        sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:295)
        sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:277)
        sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:158)
        sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
        sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
        com.tangosol.coherence.component.net.TcpRing.select(TcpRing.CDB:11)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onWait(ClusterService.CDB:6)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[Reference Handler,10,system]
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Object.java:503)
        java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
    Thread[DistributedCache,10,Cluster]
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:184)
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:237)
        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        com.cnk.travelerp.common.caching.service.SpringAwareCacheFactory.instantiateAny(SpringAwareCacheFactory.java:161)
        com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:3324)
        com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1753)
        com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1500)
        com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:4111)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.instantiateBackingMap(PartitionedCache.CDB:23)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.setCacheName(PartitionedCache.CDB:25)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ServiceConfig$ConfigListener.entryInserted(PartitionedCache.CDB:17)
        com.tangosol.util.MapEvent.dispatch(MapEvent.java:266)
        com.tangosol.util.MapEvent.dispatch(MapEvent.java:226)
        com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:567)
        com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
        com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
        com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
        com.tangosol.coherence.component.util.ServiceConfig$Map.put(ServiceConfig.CDB:43)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$StorageIdRequest.onReceived(PartitionedCache.CDB:45)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:34)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:33)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketListenerN,10,Cluster]
        java.net.TwoStacksPlainDatagramSocketImpl.receive0(Native Method)
        java.net.TwoStacksPlainDatagramSocketImpl.receive(TwoStacksPlainDatagramSocketImpl.java:90)
        java.net.DatagramSocket.receive(DatagramSocket.java:786)
        com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
        com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketPublisher,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.onWait(PacketPublisher.CDB:2)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketListener1P,10,Cluster]
        java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
        java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:105)
        java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
        java.net.DatagramSocket.receive(DatagramSocket.java:786)
        com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
        com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[main,5,main]
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Object.java:503)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.poll(Grid.CDB:26)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.poll(Grid.CDB:11)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.ensureCache(PartitionedCache.CDB:29)
        com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.ensureCache(PartitionedCache.CDB:36)
        com.tangosol.coherence.component.util.safeService.SafeCacheService.ensureCache$Router(SafeCacheService.CDB:1)
        com.tangosol.coherence.component.util.safeService.SafeCacheService.ensureCache(SafeCacheService.CDB:33)
        com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:920)
        com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(DefaultConfigurableCacheFactory.java:1296)
        com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:297)
        com.tangosol.net.CacheFactory.getCache(CacheFactory.java:204)
        com.tangosol.net.CacheFactory.getCache(CacheFactory.java:181)
        com.cnk.travelerp.common.caching.service.CacheService.<init>(CacheService.java:36)
        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
        org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735)
        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
        org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
        org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
        org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
        org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
        org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
        org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
        org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
        org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
        org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
        org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
        org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
        org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
        org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
        org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
        org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
        org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Thread[PacketListener1,10,Cluster]
        java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
        java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:105)
        java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:145)
        java.net.DatagramSocket.receive(DatagramSocket.java:786)
        com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:22)
        com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[IpMonitor,6,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.Daemon.onWait(Daemon.CDB:18)
        com.tangosol.coherence.component.util.daemon.IpMonitor.onWait(IpMonitor.CDB:4)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        java.lang.Thread.run(Thread.java:722)
    Thread[PacketSpeaker,10,Cluster]
        java.lang.Object.wait(Native Method)
        com.tangosol.coherence.component.util.queue.ConcurrentQueue.waitForEntry(ConcurrentQueue.CDB:16)
        com.tangosol.coherence.component.util.queue.ConcurrentQueue.remove(ConcurrentQueue.CDB:7)
        com.tangosol.coherence.component.util.Queue.remove(Queue.CDB:1)
        com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketSpeaker.onNotify(PacketSpeaker.CDB:21)
        com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        java.lang.Thread.run(Thread.java:722)
    Thread[Finalizer,8,system]
        java.lang.Object.wait(Native Method)
        java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
        java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
        java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)
    2013-10-10 16:10:46.607/338.358 Oracle Coherence GE 3.7.1.1 <Warning> (thread=Termination Thread, member=1): Terminating Guard{Daemon=DistributedCache}
    Coherence <Error>: Halting this cluster node due to unrecoverable service failure
    2013-10-10 16:10:47.622/339.373 Oracle Coherence GE 3.7.1.1 <Error> (thread=PacketListener1P, member=1): Stopping cluster due to unhandled exception: com.tangosol.net.messaging.ConnectionException: UdpSocket.receive: unable to reopen socket; State=STATE_CLOSED
        at com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:58)
        at com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:1)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:20)
        at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
        at java.lang.Thread.run(Thread.java:722)
    2013-10-10 16:10:47.622/339.373 Oracle Coherence GE 3.7.1.1 <D5> (thread=Cluster, member=n/a): Unexpected exception java.nio.channels.ClosedChannelException while accepting incoming TcpRing connection; refreshing listener socket
    2013-10-10 16:10:47.622/339.373 Oracle Coherence GE 3.7.1.1 <D5> (thread=Invocation:Management, member=n/a): Service Management left the cluster
    2013-10-10 16:10:47.622/339.373 Oracle Coherence GE 3.7.1.1 <Error> (thread=Cluster, member=n/a): StopRunning ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.7.1} due to unhandled exception:
    2013-10-10 16:10:47.622/339.373 Oracle Coherence GE 3.7.1.1 <Error> (thread=Cluster, member=n/a):
    java.lang.NullPointerException
        at com.tangosol.coherence.component.net.Cluster$ClusterService$TcpRing.onAcceptException(Cluster.CDB:13)
        at com.tangosol.coherence.component.net.TcpRing.onAccept(TcpRing.CDB:25)
        at com.tangosol.coherence.component.net.TcpRing.onSelect(TcpRing.CDB:27)
        at com.tangosol.coherence.component.net.TcpRing.select(TcpRing.CDB:14)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onWait(ClusterService.CDB:6)
        at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:39)
        at java.lang.Thread.run(Thread.java:722)
    2013-10-10 16:10:49.636/341.387 Oracle Coherence GE 3.7.1.1 <D5> (thread=Cluster, member=n/a): Service Cluster left the cluster
    2013-10-10 16:10:49.636/341.387 Oracle Coherence GE 3.7.1.1 <Error> (thread=Cluster, member=n/a): StopRunning ClusterService{Name=Cluster, State=(SERVICE_STOPPED, STATE_JOINED), Id=0, Version=3.7.1} due to unhandled exception:
    2013-10-10 16:10:49.636/341.387 Oracle Coherence GE 3.7.1.1 <Error> (thread=Cluster, member=n/a):
    java.nio.channels.ClosedSelectorException
        at sun.nio.ch.SelectorImpl.keys(SelectorImpl.java:69)
        at com.tangosol.coherence.component.net.TcpRing.close(TcpRing.CDB:11)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onExit(ClusterService.CDB:1)
        at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:68)
        at java.lang.Thread.run(Thread.java:722)
    Exception in thread "Cluster|SERVICE_STOPPED|Member(Id=1, Timestamp=2013-10-10 16:05:10.564, Address=10.21.12.29:8088, MachineId=29338, Location=site:,machine:mumcnk-0562,process:2696, Role=EclipseJdtRemoteTestRunner)" java.nio.channels.ClosedSelectorException
        at sun.nio.ch.SelectorImpl.keys(SelectorImpl.java:69)
        at com.tangosol.coherence.component.net.TcpRing.disconnectAll(TcpRing.CDB:6)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService$TcpRing.onLeft(ClusterService.CDB:4)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onStopRunning(ClusterService.CDB:7)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.ClusterService.onException(ClusterService.CDB:28)
        at com.tangosol.coherence.component.net.Cluster$ClusterService.onException(Cluster.CDB:7)
        at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:85)
        at java.lang.Thread.run(Thread.java:722)

    Hi,
    Did you check the documentation about how to integrate Coherence with Spring applications? Check it out: Integrating Spring with Coherence
    It seems that you are experiencing a communication problem between your web container and the Coherence cluster. Check if you are able to access simple caches and execute sample put() and get()s. Maybe the problem is not about Spring itself, it could be a communication problem.
    Cheers,
    Ricardo Ferreira

  • TT query very slow - solution is simple - hopefully

    Hello
    I have a simple view on a simple cached Table in the TT.
    When i run a query on the View - the Query Optimizer Plan sayed " NOT INDEXED:" on one column.
    The same Query on the OracleDB is faster...;-(
    Here some Informations...
    TIMESTEN ==============================================================================================
    Version 7.0.5.1 SPARC Solaris10 16GB RAM
    ttisql "DEV"
    Copyright (c) 1996-2008, Oracle. All rights reserved.
    Type ? or "help" for help, type "exit" to quit ttIsql.
    All commands must end with a semicolon character.
    connect "DSN=DEV";(Default setting AutoCommit=1)
    desc auftrag;
    Table SMITH.AUFTRAG:
    Columns:
    *ID                              NUMBER (15) NOT NULL
    KUNDE_ID NUMBER (15)
    AUFTRAGSNUMMER NUMBER (8)
    KUENDIGUNG DATE
    HAUPTAP_ID NUMBER (15)
    KUNDE_ZA_ID NUMBER (15)
    Command> select count(*) from auftrag;
    < 2507644 >
    Command> indexes auftrag;
    Indexes on table SMITH.AUFTRAG:
    AUFTRAG: unique hash index on columns:
    ID
    IDX_AUFTRAG_ID: non-unique T-tree index on columns:
    ID
    IDX_AUFTRAG_KUEN: non-unique T-tree index on columns:
    KUENDIGUNG
    IDX_AUFTRAG_KU_ID: non-unique T-tree index on columns:
    KUNDE_ID
    4 indexes found.
    The View definition:
    create view SMITH.VW_KUNDENLOGIN_ANZ_AUFTRAEGE (KUNDEN_ID, ANZAHL_AUFTRAEGE) as
    SELECT AU.KUNDE_ID, COUNT(*) FROM SMITH.AUFTRAG AU WHERE AU.KUENDIGUNG IS NULL OR (AU.KUENDIGUNG > SYSDATE) GROUP BY AU.KUNDE_ID ;
    Command> explain select * from SMITH.VW_KUNDENLOGIN_ANZ_AUFTRAEGE where Kunden_id = 375477397;
    Query Optimizer Plan:
    STEP: 1
    LEVEL: 2
    OPERATION: TblLkTtreeScan
    TBLNAME: SMITH.AUFTRAG
    IXNAME: IDX_AUFTRAG_KU_ID
    INDEXED CONDITION: <NULL>
    NOT INDEXED: AU.KUENDIGUNG > SYSDATE OR AU.KUENDIGUNG IS NULL
    STEP: 2
    LEVEL: 1
    OPERATION: SortedGroupBy
    TBLNAME: <NULL>
    IXNAME: <NULL>
    INDEXED CONDITION: <NULL>
    NOT INDEXED: <NULL>
    STEP: 3
    LEVEL: 1
    OPERATION: TmpTable
    TBLNAME: <NULL>
    IXNAME: <NULL>
    INDEXED CONDITION: <NULL>
    NOT INDEXED: VW_KUNDENLOGIN_ANZ_AUFTRAEGE.KUNDEN_ID = 375477397
    Execution time (SQLPrepare) = 0.059591 seconds.
    Command> select * from SMITH.VW_KUNDENLOGIN_ANZ_AUFTRAEGE where Kunden_id = 375477397;
    < 375477397, 29 >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 16.159090 seconds.
    ORACLE ==============================================================================================
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |
    Cost |
    | 0 | SELECT STATEMENT | | 1 | 10 |
    PLAN_TABLE_OUTPUT
    6 |
    | 1 | SORT GROUP BY NOSORT | | 1 | 10 |
    6 |
    | 2 | TABLE ACCESS BY INDEX ROWID| AUFTRAG | 17 | 170 |
    6 |
    | 3 | INDEX RANGE SCAN | FKI_AUFTRAG_HAT_KUNDE | 43 | |
    3 |
    PLAN_TABLE_OUTPUT
    SQL> select * from SMITH.VW_KUNDENLOGIN_ANZ_AUFTRAEGE where Kunden_id = 375477397;
    KUNDEN_ID ANZAHL_AUFTRAEGE
    375477397 29
    Elapsed: 00:00:00.11
    __________________________________________________________________________________________________

    Can you try rewriting the SELECT statement in the view to use UNION instead of OR and also have the GROUP BY on top of the UNION and see if that helps?
    Simon

  • [ExtermlyUrgent]How can we implement our own caching scheme in servlets???

    Hi all,
    anyone, give me any idea about implementing our own cahing sechme in servelts. Please guide me with your knowledge i also need a running sample source code to understand this concept. It is extrememly urgent please help me .
    Regards.

    try to use
    http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/cache/
    or
    http://jakarta.apache.org/turbine/jcs/
    if u are looking for a simple caching.. do it programatically.
    regards,
    Arun
    http://www.javageekz.com/

  • Cacher une colonne dans un tableau

    Bonjour, je doit créer un programme d'acquisition pour un oscilloscope. Je recueille les résultats des signaux transmi par l'oscilloscope comme la fréquence, la valeur max etc..
    J'ai donc creer un tableau on je recupère les valeurs que j'écris dans un tableur ensuite, mais j'aimerais pouvoir sélectionner les valeurs que j'envoie dans le tableau ( et donc dans le tableur) ou pas.
    Cela est-il possible? ou simplement cacher les colonnes non selectionner
    Je travail sous LabView 2012, ci joint mon VI et j'utilise un Lecroy WaveRunner 640zi  comme oscilloscope
    Merci d'avance.
    Attachments:
    VI Valeur P.vi ‏27 KB
    vi.jpg ‏174 KB

    Petit conseil, comme tu utilises la dernière version de LabVIEW, tu devrais enregistrer tes VIs à une version plus ancienne pour maximiser tes chances que les membres avec une ancienne version puissent les ouvrir... Ou simplement les partager en image .PNG
    Ton problème semble assez élémentaire. Tu peux utiliser la fonction "Delete from array" dans une boucle for avec un shift register, où tu enlèves les colonnes qui ne t'intéressent pas, ou utiliser la fonction "Index array" pour sélectionner une par une les colonnes qui t'intéressent et les ajouter dans ton shift register, et ensuite convertir ce qui reste dans ton fichier tableur.
    Je te laisse le soin de découvrir les fonctions array

Maybe you are looking for