com.sleepycat.je.utilint
Class PropUtil

java.lang.Object
  extended by com.sleepycat.je.utilint.PropUtil

public class PropUtil
extends Object

Convenience methods for handling JE properties.


Constructor Summary
PropUtil()
           
 
Method Summary
static int durationToMillis(long val, TimeUnit unit)
          Converts the given duration (interval value plus unit) to milliseconds, ensuring that any given value greater than zero converts to at least one millisecond to avoid a zero millisecond result, since Object.wait(0) waits forever.
static String formatDuration(long time, TimeUnit unit)
          Formats a String duration property (time + optional unit).
static long millisToDuration(int val, TimeUnit unit)
          Converts the given duration value in milliseconds to the given unit.
static int parseDuration(String property)
          Parses a String duration property (time + optional unit) and returns the value in millis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropUtil

public PropUtil()
Method Detail

durationToMillis

public static int durationToMillis(long val,
                                   TimeUnit unit)
Converts the given duration (interval value plus unit) to milliseconds, ensuring that any given value greater than zero converts to at least one millisecond to avoid a zero millisecond result, since Object.wait(0) waits forever.

Throws:
IllegalArgumentException - if the duration argument is illegal. Thrown via API setter methods such as Transaction.setLockTimeout.

millisToDuration

public static long millisToDuration(int val,
                                    TimeUnit unit)
Converts the given duration value in milliseconds to the given unit.

Throws:
IllegalArgumentException - if the unit is null. Thrown via API getter methods such as Transaction.getLockTimeout.

parseDuration

public static int parseDuration(String property)
Parses a String duration property (time + optional unit) and returns the value in millis.

Throws:
IllegalArgumentException - if the duration string is illegal. Thrown via the Enviornment ctor and setMutableConfig, and likewise for a ReplicatedEnvironment.

formatDuration

public static String formatDuration(long time,
                                    TimeUnit unit)
Formats a String duration property (time + optional unit). value in millis.



Copyright (c) 2004-2010 Oracle. All rights reserved.