1 25 26 package org.jrobin.core; 27 28 import java.io.IOException ; 29 30 34 public class RrdNioBackendFactory extends RrdFileBackendFactory{ 35 36 public static final String NAME = "NIO"; 37 38 39 public static final int SYNC_ONCLOSE = 0; 41 public static final int SYNC_BEFOREUPDATE = 1; 42 43 public static final int SYNC_AFTERUPDATE = 2; 44 45 public static final int SYNC_BEFOREFETCH = 3; 46 47 public static final int SYNC_AFTERFETCH = 4; 48 49 public static final int SYNC_BACKGROUND = 5; 50 56 public static final int DEFAULT_SYNC_PERIOD = 300; 58 private static int syncMode = SYNC_BACKGROUND; 59 private static int syncPeriod = DEFAULT_SYNC_PERIOD; 60 61 69 public static int getSyncMode() { 70 return syncMode; 71 } 72 73 94 public static void setSyncMode(int syncMode) { 95 RrdNioBackendFactory.syncMode = syncMode; 96 } 97 98 104 public static int getSyncPeriod() { 105 return syncPeriod; 106 } 107 108 113 public static void setSyncPeriod(int syncPeriod) { 114 RrdNioBackendFactory.syncPeriod = syncPeriod; 115 } 116 117 127 protected RrdBackend open(String path, boolean readOnly, int lockMode) throws IOException { 128 return new RrdNioBackend(path, readOnly, lockMode, syncMode, syncPeriod); 129 } 130 131 135 public String getFactoryName() { 136 return NAME; 137 } 138 } 139 | Popular Tags |