Opened 5 years ago

Closed 5 years ago

#1903 closed enhancement (invalid)

Petascope_RasImplementation should be singleton in executeRasqlQuery()

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 9.7
Component: petascope Version: development
Keywords: Cc: Dimitar Misev
Complexity: Medium

Description

Every time executeRasqlQuery invoked, this object is created while username and password can change only when Petascope restarts.

 RasImplementation impl = new 
 RasImplementation(ConfigManager.RASDAMAN_URL);
        impl.setUserIdentification(username, password);

So RasImplementation should be a singleton to be reused.

Change History (2)

comment:1 by Bang Pham Huu, 5 years ago

Code like this will be thread-safe.

public class CassandraAstyanaxConnection {

    private CassandraAstyanaxConnection(){ }        

    private static class Holder {
       private static final CassandraAstyanaxConnection INSTANCE = new CassandraAstyanaxConnection();
    }

    public static CassandraAstyanaxConnection getInstance() {
        return Holder.INSTANCE;
    }
    // rest of class omitted
}

comment:2 by Dimitar Misev, 5 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.