input
stringlengths
10
828
output
stringlengths
5
107
public lcap message get message return m msg
get the message used to define this poll
public map get agreed archival unit au if au null throw new illegal argument exception called with null au map map find au agree map au map res new hash map synchronized map for iterator it map entry set iterator it has next map entry ent map entry it next identity agreement ida identity agreement ent get value if ida has agreed res put ent get key new long ida get last agree return res
p return map peer last agree time
public deadline get deadline return m deadline
return the polls deadline
public map get disagreed archival unit au if au null throw new illegal argument exception called with null au map map find au agree map au map res new hash map synchronized map for iterator it map entry set iterator it has next map entry ent map entry it next identity agreement ida identity agreement ent get value if ida get last disagree 0 res put ent get key new long ida get last disagree return res
p returns map peer last disagree time
public void timer expired object cookie log debug3 vote timer callback called checking if i should vote if m pollstate ps wait vote log debug3 i should vote vote in poll log debug i just voted
called when the timer expires
public iterator get ip group address iterator db db int id throws sqlexception return get ip group address iterator db id null
get an iterator to the list of group members ip addresses
public void timer expired object cookie if m pollstate ps complete stop poll
called when the timer expires
boolean has voted peer identity voter id iterator it poll votes iterator while it has next vote vote vote it next if voter id vote get voter identity return true return false
determine if the voter with a given id has voted
private int protocol version from poll type int poll type switch poll type case poll v1 content poll case poll v1 name poll case poll v1 verify poll return poll v1 protocol case poll v3 poll return poll v3 protocol default return poll undefined protocol
given a poll type return the correct version of the protocol to use
public boolean is subpoll running return m called subpoll
kludge to remember whether we called a subpoll
protected void receive message lcap message msg if msg get protocol version 1 log error not a v1 message msg return int opcode msg get opcode if m msg null m msg msg log debug setting message for this from msg if opcode v1 lcap message name poll rep start vote check v1 lcap message msg
handle a message which may be a incoming vote
public int get type return poll v1 name poll
return the type of the poll poll
public iterator get metadata fieldname iterator throws sqlexception return get metadata fieldname iterator null
get an iterator to the list of configured title metadata field names
private void config v3 identities list ids current config get list param initial peers default initial peers for iterator iter ids iterator iter has next try just ensure the peer is in the id map find peer identity string iter next catch malformed identity key exception e log error malformed initial peer e
configure initial list of v3 peers
public poll call poll poll spec pollspec return call poll null pollspec
call a poll
public boolean is poll running poll spec spec synchronized poll map lock for poll manager entry pme the polls values if pme is same poll spec return pme is poll completed return false
is a poll of the given type and spec currently running
public void stop poll final int status if voter user data is poll active voter user data set active poll false else return if task null task is expired log debug2 cancelling poll time reservation task task cancel voter user data set status status clean up after the serializer poll serializer close poll poll manager close the poll voter user data get poll key log debug2 closed poll voter user data get poll key with status get status string release
stop the poll and tell the
public void stop poll stop poll status complete
stop the poll with status complete
public void abort poll stop poll status error
stop the poll with status error
public poll manager entry get poll manager entry string key synchronized poll map lock return the polls get key
return the poll manager entry for the poll with the specified key
private void abort poll with error stop poll status error
stop the poll with status error
protected array list add first text array list array list string first text if first text null for int i 0 i first text length i int index array list index of first text i if index 1 array list remove index array list add i first text i return array list
add any text items supplied by our caller at the top of the
public boolean sufficient peers return nominee counter get quorum
return true if the v3 poller should proceed to request votes
public array list get hashed blocks throw new unsupported operation exception get hashed blocks is no longer implemented
return the ordered list of hashed blocks
protected select new cluster select return new cluster select standard select length
populate a set active cluster select object
public void set status string string s this status string s
set the status of this poll
protected select new cluster select int minimum length return new cluster select ap e existingmember minimum length
populate a set active cluster select object
public void set status int s this status s
set the status of this poll
public void run task poll runner task task the task runner run task task
ask that the specified poll runner task be executed
protected select new cluster select string parameter name int minimum length select select string active cluster select list select new select parameter name false active cluster cluster utils get active cluster servlet interface if active cluster null start the list with our active cluster select add pad and encode select text active cluster minimum length false active cluster populate select select sort cluster cache cluster iterator active cluster minimum length else populate the list populate select select sort cluster cache cluster iterator minimum length return select
populate a set active cluster select object
public void release hash algorithm null hashed blocks null spec null voted peers null
release resources used by this object that are no longer required after
public psm machine get machine class action class return new psm machine poller make states action class prove intro effort
obtain a psm machine for the poller state table
protected object serializer get serializer return new xstream serializer daemon
make an xstream serializer
public void close poll if poll dir null poll dir is directory file util del tree poll dir log warning unable to delete poll state directory poll dir
clean up all resources used by this poll
protected void populate select select select iterator iterator populate select select iterator null false
populate a select box from a member iterator
protected void populate select select select iterator iterator string skip populate select select iterator skip false
populate a select box from a member iterator
protected void populate and pad select select select iterator iterator populate select select iterator null true
populate a select box from a member iterator
protected void write document to log string text document document try log debug text document xml utils serialize document catch xml exception ignore
simple debugging dump a document to the log
protected servlet interface get servlet interface return servlet interface
fetch the current servlet interface object
public void stop poll stop poll poller status complete
p stop the poll
public float get percent agreement long tallied votes tallied votes log debug2 get percent agreement agree votes agreed votes tallied votes tallied votes if agreed votes 0 tallied votes 0 return float agreed votes float tallied votes else return 0 0f
return the percent agreement for this peer
public void timer expired object cookie stop poll
called when the timer for this poll expires
public dated peer id set get no au peer set archival unit au synchronized no au peer sets dated peer id set no au set no au peer sets get au if no au set null history repository history repo get daemon get history repository au no au set history repo get no au peer set no au peer sets put au no au set return no au set
return the no au set for the au
public psm machine get machine class action class return new psm machine voter make states action class initialize
obtain a psm machine for the voter state table
public boolean is vote complete return is vote complete
return true false this peer should be asked for another vote block
public float get percent agreement return vote counts get percent agreement
return the percent agreement for this peer
public void release intro effort proof null poll ack effort proof null receipt effort proof null remaining effort proof null receipt effort proof null hash algorithm null message dir null nominees null vote blocks null psm interp null psm state null
release unneeded resources used by this object at the end of a poll
private void finish tally if has quorum log error finish tally called in inquorate poll return tally voter urls checkpoint the poll checkpoint poll do any pending repairs do repairs
after the poller has no more blocks process all the blocks any
public vote block tallier this hash block comparer null
make a tallier for a url the poller does not have
public void add tally vote block tally tally if voting started throw new illegal state exception tally added after voting started tallies add tally
add a tally which will be informed of each vote
public void vote missing participant user data id voting started true if poller has vote poller only id else vote neither id
vote that the url is missing
public void vote spoiled participant user data id voting started true log debug3 id spoiled for vote block tally tally tallies tally vote spoiled id
the voter is unable to cast a meaningful vote
private void tally voter urls string poller url log debug3 tally voter urls poller url while true string voter url url tallier peek url log debug3 voters have voter url if voter url null voter url compare to poller url 0 leave the while loop since the voter was greater than the poller url break tally voter url voter url
tally and consume all the blocks we are missing up to but not
private void tally voter urls while true string voter url url tallier peek url if voter url null leave the while loop since the voters have nothing left break tally voter url voter url
tally and consume all the remaining blocks
public void release deadline time base now ms intro effort proof null poll ack effort proof null receipt effort proof null remaining effort proof null repair effort proof null hash algorithm null message dir null nominees null poll message null psm state null vote blocks null
release unneeded resources used by this object at the end of a poll
private void next vote block entry e there s no way to tell the priority queue that the entry has changed and needs to be resorted other than remove add participants queue remove e e next vote block participants queue add e
move the entry to the next vote block
private void tally voter url string voter url log debug3 tally voter url voter url block tally tally url tallier tally voter url voter url check tally tally voter url
tally all the voters who have this block which the poller does
private block tally tally poller url string poller url hash block hash block log debug3 tally poller url poller url block tally tally url tallier tally poller url poller url hash block signal node agreement tally poller url check tally tally poller url return tally
tally all the voters who have this block which the poller also
public poller state bean load poller state throws poll serializer exception if poller state bean file exists throw new poll serializer exception no serialized state for poll log debug2 restoring poll state from poller state bean file try return poller state bean get serializer deserialize poller state bean file catch exception ex throw new poll serializer exception unable to restore poll state ex
load a poller state bean
public collection load voter states throws poll serializer exception file files poll dir list files voter filter list inner circle states new array list files length object serializer ser get serializer try for int i 0 i files length i participant user data voter state participant user data ser deserialize new file reader files i inner circle states add voter state catch exception ex throw new poll serializer exception unable to restore inner circle ex return inner circle states
return a collection containing all the poll participants user data
private void signal node agreement block tally tally string url if tally get agree voters size 0 try repository node node au util get repository node get au url if node null cr throw new should not happen exception else collection peer identity agree voter ids get voters identities tally get agree voters node signal agreement agree voter ids catch malformed urlexception ex log error malformed url while updating agreement history url
p update the node agreement history for the url
protected void save changes throws ioexception properties props new properties add config props props config mgr write cache config file props get config file name get config file comment user account acct get user account if acct null acct auditable event changed get config file name to props
save the include and exclude lists to the access control file
private list read multi line string multi line return string util break at multi line n 0 true true
convert a string of newline separated ip addresses to a vector of strings
protected void save changes throws ioexception properties props new properties add config props props log info saving props config mgr write cache config file props config manager config file plugin config plugin and title dbs
save the include and exclude lists to the access control file
private void request repair from peer string url peer identity peer log debug2 requesting repair for url url from peer participant user data ud get participant peer v3 lcap message msg ud make message v3 lcap message msg repair req msg set target url url msg set effort proof null msg set expiration get repair msg expiration try send message to msg peer catch ioexception ex log error ioexception trying to send repair request ex xxx alerts retry
request a repair from the specified peer for the specified url
public void init servlet config config throws servlet exception super init config context config get servlet context the app lockss app context get attribute servlet manager context attr lockss app servlet mgr servlet manager context get attribute servlet manager context attr servlet mgr if the app instanceof lockss daemon acct mgr get lockss daemon get account manager
run once when servlet loaded
protected boolean may page be cached return false
return true if generated page may be cached e
public float get percent agreement float agreeing urls float get agreed urls size float tallied urls float get tallied urls size float agreement if agreeing urls 0 agreement agreeing urls tallied urls else agreement 0 0f return agreement
return the percent agreement for this poll
protected void set session timeout http session session configuration config current config get current config set session timeout session config get time interval param ui session timeout default ui session timeout
set the session timeout to the configured value
protected void set session timeout http session session long time session set max inactive interval int time constants second
set the session timeout
protected http session get session if session null session req get session true if session is new set session timeout session return session
get the current session creating it if necessary and set the
protected boolean has session return req get session false null
return true iff a session has already been established
private void checkpoint poll if serializer null try serializer save poller state poller state bytes hashed since last checkpoint 0 catch poll serializer exception ex log warning unable to save poller state ex
checkpoint the per poll state
protected string get new session object id http session session get session synchronized session integer id integer get session get attribute session key object id if id null id new integer 1 session set attribute session key object id new integer id int value 1 return id to string
get an unused id string for storing an object in the session
protected object get session id object string id http session session get session synchronized session bidi map map bidi map session get attribute session key obj map if map null return null return map get key id
get the object associated with the id in the session
protected string get session id string string id return string get session id object id
get the string associated with the id in the session
protected string get session object id object obj http session session get session bidi map map synchronized session map bidi map session get attribute session key obj map if map null map new dual hash bidi map session set attribute session key obj map map synchronized map string id string map get obj if id null id get new session object id map put obj id return id
get the id with which the object is associated with the session if
protected boolean link me in nav return false
servlets may override this to determine whether they should be
protected void construct inner circle int quorum map avail map get available peers log debug3 construct inner circle quorum quorum avail map size available collection inner circle voters find npeers to invite get target size log debug2 selected inner circle voters size participants for poll id poller state get poll key add peers to inner circle inner circle voters false false
build the initial set of inner circle peers
public void set last poll time string au id long last poll time get entry au id last poll time last poll time
set the last completed v3 poll time for an au
public long get last poll time string au id return get entry au id last poll time
get the last completed v3 poll time for an au
public void increment num polls string au id get entry au id num polls
increment the number of completed v3 polls for an au
public int get num polls string au id return get entry au id num polls
return the number of polls since the last restart for
public void set agreement string au id float agreement get entry au id agreement agreement
set the percent agreement for an archival unit as of the
public float get agreement string au id return get entry au id agreement
return the percent agreement for an archival unit as of the last
protected element submit button string label string action return submit button label action null null
return a button that invokes the javascript submit routine with the
protected element radio button string label string key boolean checked return radio button label label key checked
return a labelled rasio button
protected string grey text string txt boolean is grey if is grey return txt return font color gray txt font
add html tags to grey the text if is grey is true
protected element set tab order element ele ele attribute tabindex tabindex return ele
set this element next in the tab order
public void timer expired object cookie log debug poll time has expired if poller state expecting repairs extra poll time 0 log debug still expecting some repairs holding the poll open for another extra poll time ms compute the new deadline and replace the existing deadline deadline new deadline deadline at poller state get poll deadline extra poll time timer queue schedule new deadline new extra time callback null poller state set poll deadline new deadline get expiration time return else log debug no expected repairs remain ready to end the poll vote complete
called when the poll timer expires
protected string add footnote string s if s null s length 0 return if foot number 0 if footnotes null footnotes new vector 10 10 else footnotes remove all elements int n footnotes index of s if n 0 n foot number footnotes add element s return sup font size 1 a href foottag n 1 n 1 a font sup
store a footnote assign it a number return html for footnote
protected void add java script composite comp string include string context get attribute attr include script if string util is null string include link to java script comp else include java script0 comp
add javascript to page
protected void display msg in lieu of page string msg throws ioexception todo look at html page page new page composite warning new composite warning add msg warning add br page add warning layout footer page page write resp get writer
display a message in lieu of the normal page
protected void display warning in lieu of page string msg throws ioexception display msg in lieu of page center font color red size 1 msg font center
display a warning in red in lieu of the normal page
protected void display not started throws ioexception display warning in lieu of page this lockss box is still starting please srv link my servlet descr try again get params as props in a moment
display the cache isnt ready yet come back later
protected lockss app get lockss app return the app
return the app instance
protected lockss daemon get lockss daemon return lockss daemon the app
return the daemon instance assumes that the servlet is running in
public void add recalc au archival unit au recalcing aus add au
remember that we have scheduled a hash to recalculate the hash time
public void set message lcap message msg not implemented
set the message that created this poll
public void remove recalc au archival unit au recalcing aus remove au
done with hash to recalculate the hash time for this au