本文整理汇总了Java中org.apache.jena.atlas.logging.FmtLog.warn方法的典型用法代码示例。如果您正苦于以下问题:Java FmtLog.warn方法的具体用法?Java FmtLog.warn怎么用?Java FmtLog.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.atlas.logging.FmtLog
的用法示例。
在下文中一共展示了FmtLog.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSystem
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** After Delta has initialized, make sure some sort of PatchStore provision is set. */
static private void initSystem() {
// Ensure the file-based PatchStore provider is available
if ( ! PatchStoreMgr.isRegistered(DPS.PatchStoreFileProvider) ) {
FmtLog.warn(LOG, "PatchStoreFile provider not registered");
PatchStore ps = new PatchStoreFile();
if ( ! DPS.PatchStoreFileProvider.equals(ps.getProviderName())) {
FmtLog.error(LOG, "PatchStoreFile provider name is wrong (expected=%s, got=%s)", DPS.PatchStoreFileProvider, ps.getProviderName());
throw new DeltaConfigException();
}
PatchStoreMgr.register(ps);
}
// if ( ! PatchStoreMgr.isRegistered(DPS.PatchStoreMemProvider) ) {
// PatchStore psMem = new PatchStoreMem(DPS.PatchStoreMemProvider);
// PatchStoreMgr.register(psMem);
// }
// Default the log provider to "file"
if ( PatchStoreMgr.getDftPatchStore() == null ) {
//FmtLog.warn(LOG, "PatchStore default not set.");
PatchStoreMgr.setDftPatchStoreName(DPS.PatchStoreFileProvider);
}
}
示例2: allocateFilename
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/**
* Return the {@link #nextFilename} along with a temporary filename.
* <p>
* This operation is thread-safe.
*/
public FileEntry allocateFilename() {
// --> IOX
// TODO Use Files.createTempFile? Or does recovery mean we need more control?
synchronized(this) {
for ( ;; ) {
long idx = nextIndex();
Path fn = filename(idx);
if ( Files.exists(fn) ) {
FmtLog.warn(LOG, "Skipping existing file: %s", fn);
continue;
}
Path tmpFn = filename(directory, tmpBasename, idx);
if ( Files.exists(tmpFn) ) {
FmtLog.warn(LOG, "Skipping existing tmp file: %s", tmpFn);
continue;
}
return new FileEntry(idx, fn, tmpFn) ;
}
}
}
示例3: scanForIndex
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** Find the indexes of files in this FileStore. Return sorted, low to high. */
private static List<Long> scanForIndex(Path directory, String namebase) {
List<Long> indexes = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory, namebase + "*")) {
for ( Path f : stream ) {
long num = extractIndex(f.getFileName().toString(), namebase);
if ( num == -1 ) {
FmtLog.warn(LOG, "Can't parse filename: %s", f.toString());
continue;
}
indexes.add(num);
}
} catch (IOException ex) {
FmtLog.warn(LOG, "Can't inspect directory: (%s, %s)", directory, namebase);
throw new PatchException(ex);
}
indexes.sort(Long::compareTo);
return indexes;
}
示例4: deleteTmpFiles
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** Find the indexes of files in this FileStore. Return sorted, low to high. */
private static boolean deleteTmpFiles(Path directory) {
boolean found = false;
try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory, tmpBasename + "*")) {
for ( Path f : stream ) {
found = true;
Files.delete(f);
if ( Files.exists(f) )
FmtLog.error(LOG, "Failed to delete tmp file: %s", f);
}
} catch (IOException ex) {
FmtLog.warn(LOG, "Can't check directory for tmp files: %s", directory);
throw new PatchException(ex);
}
return found;
}
示例5: validate
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** Validate a patch for this {@code PatchLog} */
public boolean validate(RDFPatch patch) {
Id previousId = Id.fromNode(patch.getPrevious());
Id patchId = Id.fromNode(patch.getId());
if ( previousId == null ) {
if ( !isEmpty() ) {
FmtLog.warn(LOG, "No previous for patch when PatchLog is not empty: patch=%s", patchId);
return false;
}
} else {
if ( isEmpty() ) {
FmtLog.warn(LOG, "Previous reference for patch but PatchLog is empty: patch=%s : previous=%s", patchId, previousId);
return false ;
}
}
try {
validate(patch.header(), patchId, previousId, this::badPatchEx);
return true ;
} catch (DeltaException ex) { return false; }
}
示例6: isFormattedDataState
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
private static boolean isFormattedDataState(Path path) {
// Directory: "data/"
// File: "state"
boolean good = true;
Path dataArea = path.resolve(DeltaConst.DATA);
// if ( ! Files.exists(dataArea) ) {
// // Should check its not a memory area.
// FmtLog.warn(DataState.LOG, "No data area: %s", path);
// good = false;
// //return false;
// }
Path pathState = path.resolve(DeltaConst.STATE_CLIENT);
if ( ! Files.exists(pathState) ) {
FmtLog.warn(DataState.LOG, "No state file: %s", path);
good = false;
}
// Development - try to continue.
return true;
//return good;
}
示例7: buildClientIndex
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
public static ClusterTupleIndex buildClientIndex(ConfCluster confCluster, ConfIndex ci, List<Component> startables, String hereVNode) {
String idxOrder = ci.indexOrder ;
int N = idxOrder.length() ;
if ( N != 3 && N != 4 )
FmtLog.warn(logConf, "Strange index size: %d (from '%s')", N, idxOrder) ;
TupleMap tmap = TupleMap.create("SPO", idxOrder) ;
DistributorTuplesReplicate dist = new DistributorTuplesReplicate(hereVNode, tmap) ;
List<TupleIndexRemote> indexes = new ArrayList<>() ;
// Scan shards for index.
confCluster.eltsIndex.stream().sequential()
.filter(x -> ci.indexOrder.equals(x.conf.indexOrder))
.forEach(x -> {
// Is it "here"?
if ( x.addr.sameHost(hereVNode) )
logConf.info("HERE: Index: "+x.addr.getPort()) ;
NetAddr netAddr = x.addr.placement(confCluster.placements, x.addr.getPort()) ;
TupleIndexRemote idx = TupleIndexRemote.create(hereVNode, netAddr.getName(), netAddr.getPort(), idxOrder, tmap) ;
indexes.add(idx) ;
startables.add(idx) ;
}) ;
dist.add(indexes);
// All shards, all replicas.
ClusterTupleIndex tupleIndex = new ClusterTupleIndex(dist, N, tmap, ci.indexOrder);
return tupleIndex ;
}
示例8: getAllocateNodeId
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
@Override
public NodeId getAllocateNodeId(Node node) {
// XXX Could useful know whether it was find or store
// find - stop early, store, do all
List<NodeTableRemote> tables = distributor.storeAt(node) ;
NodeId nid = null ;
for ( NodeTableRemote nt : tables ) {
NodeId nid1 = nt.getAllocateNodeId(node) ;
if ( nid == null )
nid = nid1 ;
else {
if ( ! Objects.equals(nid, nid1) )
FmtLog.warn(log, "Different NodeIds allocated for %s : %s != %s", node, nid, nid1) ;
}
}
FmtLog.debug(log, "getAllocateNodeId(%s) -> %s", node, nid) ;
if ( log.isDebugEnabled() )
tables.forEach(nt -> FmtLog.debug(log, " store(%s) @ %s", node, nt)) ;
return nid ;
}
示例9: release
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** Release this {@code FileStore} - do not use again. */
public void release() {
// Overlapping outstanding operations can continue.
Path k = key(directory, basename);
FileStore old = areas.remove(k);
if ( old == null )
FmtLog.warn(LOG, "Releasing non-existent FileStore: (%s, %s)", directory, basename);
}
示例10: release
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/**
* Release ("delete") the {@link PatchLog}.
* @param patchLog
*/
public static void release(PatchLog patchLog) {
Id dsRef = patchLog.getDescription().getDataSourceId();
if ( ! logExists(dsRef) ) {
FmtLog.warn(LOG, "PatchLog not known to PatchStore: dsRef=%s", dsRef);
return;
}
logs.remove(dsRef);
patchLog.release();
}
示例11: append
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
@Override
public long append(Id dsRef, RDFPatch patch) {
checkLink();
long t1 = System.currentTimeMillis();
String str = retry(()->{
RDFChangesHTTP remote = createRDFChanges(dsRef);
// [NET] Network point
// If not re-applyable, we need a copy.
patch.apply(remote);
return remote.getResponse();
},
()->patch.repeatable(),
()->"Retry append patch.", ()->"Failed to append patch : "+dsRef);
long t2 = System.currentTimeMillis();
long elapsed_ms = (t2-t1);
if ( str != null ) {
try {
JsonObject obj = JSON.parse(str);
int version = obj.get(DeltaConst.F_VERSION).getAsNumber().value().intValue();
return version;
} catch (Exception ex) {
FmtLog.warn(this.getClass(), "[%s] Error in response body : %s", dsRef, ex.getMessage());
}
} else {
FmtLog.warn(this.getClass(), "[%s] No response body", dsRef);
}
// No response body or syntax error.
return -1;
}
示例12: DeltaConnection
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
private DeltaConnection(DataState dataState, DatasetGraph basedsg, DeltaLink link, TxnSyncPolicy syncTxnBegin) {
Objects.requireNonNull(dataState, "DataState");
Objects.requireNonNull(link, "DeltaLink");
//Objects.requireNonNull(basedsg, "base DatasetGraph");
if ( basedsg instanceof DatasetGraphChanges )
FmtLog.warn(this.getClass(), "[%s] DatasetGraphChanges passed into %s", dataState.getDataSourceId() ,Lib.className(this));
this.state = dataState;
this.base = basedsg;
this.datasourceId = dataState.getDataSourceId();
this.datasourceName = dataState.getDatasourceName();
this.dLink = link;
this.valid = true;
this.syncTxnBegin = syncTxnBegin;
if ( basedsg == null ) {
this.target = null;
this.managed = null;
this.managedDataset = null;
this.managedNoEmpty = null;
this.managedNoEmptyDataset = null;
return;
}
// Where to put incoming changes.
this.target = new RDFChangesApply(basedsg);
// Where to send outgoing changes.
RDFChanges monitor = createRDFChanges(datasourceId);
this.managed = new DatasetGraphChanges(basedsg, monitor, null, syncer(syncTxnBegin));
this.managedDataset = DatasetFactory.wrap(managed);
// ----
RDFChanges monitor1 = new RDFChangesSuppressEmpty(monitor);
this.managedNoEmpty = new DatasetGraphChanges(basedsg, monitor1, null, syncer(syncTxnBegin));
this.managedNoEmptyDataset = DatasetFactory.wrap(managedNoEmpty);
}
示例13: append
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** Send a patch to log server. */
public synchronized void append(RDFPatch patch) {
checkDeltaConnection();
long ver = dLink.append(datasourceId, patch);
if ( ver < 0 )
// Didn't happen.
return ;
long ver0 = state.version();
if ( ver0 >= ver )
FmtLog.warn(LOG, "[%s] Version did not advance: %d -> %d", datasourceId.toString(), ver0 , ver);
state.updateState(ver, Id.fromNode(patch.getId()));
}
示例14: syncToVersion
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
/** Sync until some version */
private void syncToVersion(long version) {
//long remoteVer = getRemoteVersionLatestOrDefault(VERSION_UNSET);
if ( version == VERSION_UNSET ) {
FmtLog.warn(LOG, "Sync: Failed to sync");
return;
}
long localVer = getLocalVersion();
// -1 ==> no entries, uninitialized.
if ( localVer < 0 ) {
FmtLog.info(LOG, "Sync: No log entries");
localVer = 0 ;
setLocalState(localVer, (Node)null);
return;
}
if ( localVer > version )
FmtLog.info(LOG, "[%s] Local version ahead of remote : [local=%d, remote=%d]", datasourceId, getLocalVersion(), getRemoteVersionCached());
if ( localVer >= version )
return;
// bring up-to-date.
FmtLog.info(LOG, "Sync: Versions [%d, %d]", localVer, version);
playPatches(localVer+1, version) ;
//FmtLog.info(LOG, "Now: Versions [%d, %d]", getLocalVersion(), remoteVer);
}
示例15: getPatchLogInfo
import org.apache.jena.atlas.logging.FmtLog; //导入方法依赖的package包/类
public PatchLogInfo getPatchLogInfo() {
checkDeltaConnection();
PatchLogInfo info = dLink.getPatchLogInfo(datasourceId);
if ( info != null ) {
if ( remote.get() != null ) {
if ( getRemoteVersionCached() > 0 && info.getMaxVersion() < getRemoteVersionCached() )
FmtLog.warn(LOG, "[%s] Remote version behind local tracking of remote version: [%d, %d]", datasourceId, info.getMaxVersion(), getRemoteVersionCached());
}
// Set the local copy whenever we get the remote latest.
remote.set(info);
}
return info;
}