コード例 #1
0
 /**
  * Create a new loggable object for the given type.
  *
  * @param type
  * @param transactId the id of the current transaction.
  * @throws LogException
  */
 public static final Loggable create(byte type, DBBroker broker, long transactId)
     throws LogException {
   LogEntry entry = (LogEntry) entryTypes.get(type);
   if (entry == null) return null;
   try {
     return entry.newInstance(broker, transactId);
   } catch (Exception e) {
     throw new LogException("Failed to create log entry object", e);
   }
 }
コード例 #2
0
 /**
  * Add an entry type to the registry.
  *
  * @param type
  * @param clazz the class implementing {@link Loggable}.
  */
 public static final void addEntryType(byte type, Class clazz) {
   LogEntry entry = new LogEntry(type, clazz);
   entryTypes.put(type, entry);
 }