org.codehaus.wadi.impl
Class FixedWidthSessionIdFactory

java.lang.Object
  extended byorg.codehaus.wadi.impl.FixedWidthSessionIdFactory
All Implemented Interfaces:
PartitionMapper, SessionIdFactory

public class FixedWidthSessionIdFactory
extends Object
implements SessionIdFactory, PartitionMapper


Field Summary
protected  int _base
           
protected  char[] _chars
           
protected static char[] _defaultChars
           
protected  char[] _divider
           
protected  int _keyLength
           
protected  Log _log
           
protected  int[] _lookup
           
protected  int _numPartitions
           
protected  int _partitionLength
           
protected  Random _random
           
protected  int _sectLength
           
 
Constructor Summary
FixedWidthSessionIdFactory(int width, char[] chars, int numPartitions)
           
FixedWidthSessionIdFactory(int width, int numPartitions)
           
 
Method Summary
 String create()
           
 String create(int partition)
           
protected  int decode(char[] buffer, int from, int length)
           
protected  int encode(long sect, int iters, char[] buffer, int offset)
           
 int getPartition(String key)
           
 int getSessionIdLength()
           
static void main(String[] args)
           
 int map(Object key)
          Given a key, map it to the corresponding Partition index.
 void setSessionIdLength(int l)
           
protected  int size(int n)
           
protected  int size(long l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected final Log _log

_defaultChars

protected static final char[] _defaultChars

_divider

protected final char[] _divider

_random

protected Random _random

_lookup

protected final int[] _lookup

_keyLength

protected final int _keyLength

_chars

protected final char[] _chars

_base

protected final int _base

_sectLength

protected final int _sectLength

_numPartitions

protected final int _numPartitions

_partitionLength

protected final int _partitionLength
Constructor Detail

FixedWidthSessionIdFactory

public FixedWidthSessionIdFactory(int width,
                                  int numPartitions)

FixedWidthSessionIdFactory

public FixedWidthSessionIdFactory(int width,
                                  char[] chars,
                                  int numPartitions)
Method Detail

create

public String create()
Specified by:
create in interface SessionIdFactory

getSessionIdLength

public int getSessionIdLength()
Specified by:
getSessionIdLength in interface SessionIdFactory

setSessionIdLength

public void setSessionIdLength(int l)
Specified by:
setSessionIdLength in interface SessionIdFactory

create

public String create(int partition)

encode

protected int encode(long sect,
                     int iters,
                     char[] buffer,
                     int offset)

getPartition

public int getPartition(String key)

decode

protected int decode(char[] buffer,
                     int from,
                     int length)

size

protected int size(long l)

size

protected int size(int n)

main

public static void main(String[] args)

map

public int map(Object key)
Description copied from interface: PartitionMapper
Given a key, map it to the corresponding Partition index.

Specified by:
map in interface PartitionMapper
Parameters:
key -
Returns:


Copyright © 2004-2006 Core Developers Network Ltd.. All Rights Reserved.