use of org.apache.ignite.IgniteCheckedException in project ignite by apache.
the class IgniteH2Indexing method registerCache.
/** {@inheritDoc} */
@Override
public void registerCache(String cacheName, String schemaName, GridCacheContext<?, ?> cctx) throws IgniteCheckedException {
if (!isDefaultSchema(schemaName)) {
if (schemas.putIfAbsent(schemaName, new H2Schema(schemaName)) != null)
throw new IgniteCheckedException("Schema already registered: " + U.maskName(schemaName));
createSchema(schemaName);
}
cacheName2schema.put(cacheName, schemaName);
createSqlFunctions(schemaName, cctx.config().getSqlFunctionClasses());
}
use of org.apache.ignite.IgniteCheckedException in project ignite by apache.
the class GridDhtPartitionsExchangeFuture method onReceive.
/**
* @param node Sender node.
* @param msg Full partition info.
*/
public void onReceive(final ClusterNode node, final GridDhtPartitionsFullMessage msg) {
assert msg != null;
final UUID nodeId = node.id();
if (isDone()) {
if (log.isDebugEnabled())
log.debug("Received message for finished future [msg=" + msg + ", fut=" + this + ']');
return;
}
if (log.isDebugEnabled())
log.debug("Received full partition map from node [nodeId=" + nodeId + ", msg=" + msg + ']');
initFut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
@Override
public void apply(IgniteInternalFuture<Boolean> f) {
try {
if (!f.get())
return;
} catch (IgniteCheckedException e) {
U.error(log, "Failed to initialize exchange future: " + this, e);
return;
}
processMessage(node, msg);
}
});
}
use of org.apache.ignite.IgniteCheckedException in project ignite by apache.
the class GridCacheQueryManager method scanIterator.
/**
* @param qry Query.
* @param locNode Local node.
* @return Full-scan row iterator.
* @throws IgniteCheckedException If failed to get iterator.
*/
@SuppressWarnings({ "unchecked" })
private GridCloseableIterator<IgniteBiTuple<K, V>> scanIterator(final GridCacheQueryAdapter<?> qry, boolean locNode) throws IgniteCheckedException {
final IgniteBiPredicate<K, V> keyValFilter = qry.scanFilter();
try {
injectResources(keyValFilter);
Integer part = qry.partition();
if (cctx.isLocal())
part = null;
if (part != null && (part < 0 || part >= cctx.affinity().partitions()))
return new GridEmptyCloseableIterator<>();
final ExpiryPolicy plc = cctx.expiry();
AffinityTopologyVersion topVer = GridQueryProcessor.getRequestAffinityTopologyVersion();
if (topVer == null)
topVer = cctx.affinity().affinityTopologyVersion();
final boolean backups = qry.includeBackups() || cctx.isReplicated();
final GridDhtLocalPartition locPart;
final GridIterator<CacheDataRow> it;
if (part != null) {
final GridDhtCacheAdapter dht = cctx.isNear() ? cctx.near().dht() : cctx.dht();
GridDhtLocalPartition locPart0 = dht.topology().localPartition(part, topVer, false);
if (locPart0 == null || locPart0.state() != OWNING || !locPart0.reserve())
throw new GridDhtUnreservedPartitionException(part, cctx.affinity().affinityTopologyVersion(), "Partition can not be reserved");
if (locPart0.state() != OWNING) {
locPart0.release();
throw new GridDhtUnreservedPartitionException(part, cctx.affinity().affinityTopologyVersion(), "Partition can not be reserved");
}
locPart = locPart0;
it = cctx.offheap().iterator(part);
} else {
locPart = null;
it = cctx.offheap().iterator(true, backups, topVer);
}
return new PeekValueExpiryAwareIterator(it, plc, topVer, keyValFilter, qry.keepBinary(), locNode) {
@Override
protected void onClose() {
super.onClose();
if (locPart != null)
locPart.release();
closeScanFilter(keyValFilter);
}
};
} catch (IgniteCheckedException | RuntimeException e) {
closeScanFilter(keyValFilter);
throw e;
}
}
use of org.apache.ignite.IgniteCheckedException in project ignite by apache.
the class GridCacheStoreManagerAdapter method sessionInit0.
/**
* @param tx Current transaction.
* @throws IgniteCheckedException If failed.
*/
private void sessionInit0(@Nullable IgniteInternalTx tx) throws IgniteCheckedException {
assert sesHolder != null;
SessionData ses;
if (tx != null) {
ses = tx.meta(SES_ATTR);
if (ses == null) {
ses = new SessionData(tx, cctx.name());
tx.addMeta(SES_ATTR, ses);
} else
// Session cache name may change in cross-cache transaction.
ses.cacheName(cctx.name());
} else
ses = new SessionData(null, cctx.name());
sesHolder.set(ses);
try {
if (sesLsnrs != null && !ses.started(this)) {
for (CacheStoreSessionListener lsnr : sesLsnrs) lsnr.onSessionStart(locSes);
}
} catch (Exception e) {
throw new IgniteCheckedException("Failed to start store session: " + e, e);
}
}
use of org.apache.ignite.IgniteCheckedException in project ignite by apache.
the class DataStreamProcessor method start.
/** {@inheritDoc} */
@Override
public void start(boolean activeOnStart) throws IgniteCheckedException {
if (ctx.config().isDaemon())
return;
marshErrBytes = U.marshal(marsh, new IgniteCheckedException("Failed to marshal response error, " + "see node log for details."));
flusher = new IgniteThread(new GridWorker(ctx.igniteInstanceName(), "grid-data-loader-flusher", log) {
@Override
protected void body() throws InterruptedException {
while (!isCancelled()) {
DataStreamerImpl<K, V> ldr = flushQ.take();
if (!busyLock.enterBusy())
return;
try {
if (ldr.isClosed())
continue;
ldr.tryFlush();
flushQ.offer(ldr);
} finally {
busyLock.leaveBusy();
}
}
}
});
flusher.start();
if (log.isDebugEnabled())
log.debug("Started data streamer processor.");
}
Aggregations