common
Class CacheUtilities

java.lang.Object
  extended by common.CacheUtilities

public class CacheUtilities
extends java.lang.Object


Nested Class Summary
static class CacheUtilities.ListenerCmdType
           
 
Field Summary
static int deserialize_buffer_size
           
static boolean LOCK_TABLE_EXPLICIT
           
static int MAX_UPDATE_RETRIES
           
static int UPDATE_RETRY_SLEEP_TIME
           
static boolean USE_LISTENER_START_CACHE
           
 
Constructor Summary
CacheUtilities()
           
 
Method Summary
static boolean CacheDelete(com.meetup.memcached.MemcachedClient cacheclient, java.lang.String key)
           
static byte[] CacheGet(com.meetup.memcached.MemcachedClient cacheclient, java.lang.String key, boolean compressPayload)
           
static byte[] CacheGetNoLease(com.meetup.memcached.MemcachedClient cacheclient, java.lang.String key, boolean compressPayload)
           
static boolean CacheSet(com.meetup.memcached.MemcachedClient cacheclient, java.lang.String key, byte[] payload, boolean useTTL, int TTLvalue, boolean compressPayload)
           
static byte[] compressBytes(byte[] input)
           
static byte[] decompressBytes(byte[] input)
           
static java.sql.ResultSet ExecuteQuery(java.sql.Connection conn, java.sql.PreparedStatement preparedStatement, java.sql.PreparedStatement lockStatement, java.lang.String tablename)
           
static java.sql.ResultSet ExecuteQuery(java.sql.Connection conn, java.sql.PreparedStatement preparedStatement, java.sql.PreparedStatement lockStatement, java.lang.String[] tablenames)
           
static boolean ExecuteUpdateStmt(java.sql.Connection conn, java.sql.PreparedStatement pstmt, java.sql.PreparedStatement lockStatement, java.lang.String tablename)
           
static boolean ExecuteUpdateStmt(java.sql.Connection conn, java.sql.PreparedStatement pstmt, java.sql.PreparedStatement lockStatement, java.lang.String[] tablenames)
           
static java.lang.String getLockStatement(java.lang.String tablename, boolean exclusiveMode)
           
static void LockRow(java.sql.PreparedStatement pstmt, java.lang.String tablename, boolean exclusiveMode)
           
static void runListener(java.lang.String listener_hostname, int listener_port, CacheUtilities.ListenerCmdType type, java.lang.String command)
           
static void runListener(java.lang.String listener_hostname, int listener_port, java.lang.String command)
           
static byte[] SerializeHashMap(java.util.HashMap<java.lang.String,ByteIterator> m)
           
static byte[] SerializeVectorOfHashMaps(java.util.Vector<java.util.HashMap<java.lang.String,ByteIterator>> m)
           
static byte[] SerializeVectorOfInts(java.util.Vector<java.lang.Integer> m)
           
static void startCOSAR(java.lang.String cache_hostname, int listener_port)
           
static void startMemcached(java.lang.String listener_hostname, int listener_port)
           
static void stopMemcached(java.lang.String listener_hostname, int listener_port)
           
static boolean unMarshallHashMap(java.util.HashMap<java.lang.String,ByteIterator> m, byte[] payload)
           
static boolean unMarshallHashMap(java.util.HashMap<java.lang.String,ByteIterator> m, byte[] payload, byte[] read_buffer)
           
static boolean unMarshallVectorOfHashMaps(byte[] payload, java.util.Vector<java.util.HashMap<java.lang.String,ByteIterator>> V)
           
static boolean unMarshallVectorOfHashMaps(byte[] payload, java.util.Vector<java.util.HashMap<java.lang.String,ByteIterator>> V, byte[] read_buffer)
           
static boolean unMarshallVectorOfInts(byte[] payload, java.util.Vector<java.lang.Integer> V)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

deserialize_buffer_size

public static final int deserialize_buffer_size
See Also:
Constant Field Values

MAX_UPDATE_RETRIES

public static final int MAX_UPDATE_RETRIES
See Also:
Constant Field Values

UPDATE_RETRY_SLEEP_TIME

public static final int UPDATE_RETRY_SLEEP_TIME
See Also:
Constant Field Values

LOCK_TABLE_EXPLICIT

public static final boolean LOCK_TABLE_EXPLICIT
See Also:
Constant Field Values

USE_LISTENER_START_CACHE

public static boolean USE_LISTENER_START_CACHE
Constructor Detail

CacheUtilities

public CacheUtilities()
Method Detail

compressBytes

public static byte[] compressBytes(byte[] input)
                            throws java.io.UnsupportedEncodingException,
                                   java.io.IOException
Throws:
java.io.UnsupportedEncodingException
java.io.IOException

decompressBytes

public static byte[] decompressBytes(byte[] input)
                              throws java.io.UnsupportedEncodingException,
                                     java.io.IOException,
                                     java.util.zip.DataFormatException
Throws:
java.io.UnsupportedEncodingException
java.io.IOException
java.util.zip.DataFormatException

SerializeHashMap

public static byte[] SerializeHashMap(java.util.HashMap<java.lang.String,ByteIterator> m)

SerializeVectorOfHashMaps

public static byte[] SerializeVectorOfHashMaps(java.util.Vector<java.util.HashMap<java.lang.String,ByteIterator>> m)

SerializeVectorOfInts

public static byte[] SerializeVectorOfInts(java.util.Vector<java.lang.Integer> m)

unMarshallHashMap

public static boolean unMarshallHashMap(java.util.HashMap<java.lang.String,ByteIterator> m,
                                        byte[] payload)

unMarshallHashMap

public static boolean unMarshallHashMap(java.util.HashMap<java.lang.String,ByteIterator> m,
                                        byte[] payload,
                                        byte[] read_buffer)

unMarshallVectorOfHashMaps

public static boolean unMarshallVectorOfHashMaps(byte[] payload,
                                                 java.util.Vector<java.util.HashMap<java.lang.String,ByteIterator>> V)

unMarshallVectorOfHashMaps

public static boolean unMarshallVectorOfHashMaps(byte[] payload,
                                                 java.util.Vector<java.util.HashMap<java.lang.String,ByteIterator>> V,
                                                 byte[] read_buffer)

unMarshallVectorOfInts

public static boolean unMarshallVectorOfInts(byte[] payload,
                                             java.util.Vector<java.lang.Integer> V)

getLockStatement

public static java.lang.String getLockStatement(java.lang.String tablename,
                                                boolean exclusiveMode)

LockRow

public static void LockRow(java.sql.PreparedStatement pstmt,
                           java.lang.String tablename,
                           boolean exclusiveMode)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

ExecuteQuery

public static java.sql.ResultSet ExecuteQuery(java.sql.Connection conn,
                                              java.sql.PreparedStatement preparedStatement,
                                              java.sql.PreparedStatement lockStatement,
                                              java.lang.String tablename)
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

ExecuteQuery

public static java.sql.ResultSet ExecuteQuery(java.sql.Connection conn,
                                              java.sql.PreparedStatement preparedStatement,
                                              java.sql.PreparedStatement lockStatement,
                                              java.lang.String[] tablenames)
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

ExecuteUpdateStmt

public static boolean ExecuteUpdateStmt(java.sql.Connection conn,
                                        java.sql.PreparedStatement pstmt,
                                        java.sql.PreparedStatement lockStatement,
                                        java.lang.String tablename)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

ExecuteUpdateStmt

public static boolean ExecuteUpdateStmt(java.sql.Connection conn,
                                        java.sql.PreparedStatement pstmt,
                                        java.sql.PreparedStatement lockStatement,
                                        java.lang.String[] tablenames)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

runListener

public static void runListener(java.lang.String listener_hostname,
                               int listener_port,
                               java.lang.String command)

startMemcached

public static void startMemcached(java.lang.String listener_hostname,
                                  int listener_port)

stopMemcached

public static void stopMemcached(java.lang.String listener_hostname,
                                 int listener_port)

runListener

public static void runListener(java.lang.String listener_hostname,
                               int listener_port,
                               CacheUtilities.ListenerCmdType type,
                               java.lang.String command)

startCOSAR

public static void startCOSAR(java.lang.String cache_hostname,
                              int listener_port)

CacheGet

public static byte[] CacheGet(com.meetup.memcached.MemcachedClient cacheclient,
                              java.lang.String key,
                              boolean compressPayload)

CacheGetNoLease

public static byte[] CacheGetNoLease(com.meetup.memcached.MemcachedClient cacheclient,
                                     java.lang.String key,
                                     boolean compressPayload)

CacheSet

public static boolean CacheSet(com.meetup.memcached.MemcachedClient cacheclient,
                               java.lang.String key,
                               byte[] payload,
                               boolean useTTL,
                               int TTLvalue,
                               boolean compressPayload)

CacheDelete

public static boolean CacheDelete(com.meetup.memcached.MemcachedClient cacheclient,
                                  java.lang.String key)