use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class QueueProxyImpl method toArray.
@Nonnull
@Override
public <T> T[] toArray(@Nonnull T[] ts) {
checkNotNull(ts, "Null array parameter is not allowed!");
T[] tsParam = ts;
final NodeEngine nodeEngine = getNodeEngine();
List<Data> list = listInternal();
int size = list.size();
if (tsParam.length < size) {
tsParam = (T[]) java.lang.reflect.Array.newInstance(tsParam.getClass().getComponentType(), size);
}
for (int i = 0; i < size; i++) {
tsParam[i] = nodeEngine.toObject(list.get(i));
}
return tsParam;
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class QueueProxyImpl method poll.
@Override
public E poll(long timeout, @Nonnull TimeUnit timeUnit) throws InterruptedException {
checkNotNull(timeUnit, "Null timeUnit is not allowed!");
final NodeEngine nodeEngine = getNodeEngine();
final Object data = pollInternal(timeUnit.toMillis(timeout));
return nodeEngine.toObject(data);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class QueueProxyImpl method drainTo.
@Override
public int drainTo(@Nonnull Collection<? super E> objects, int i) {
checkNotNull(objects, "Null objects parameter is not allowed!");
checkFalse(this.equals(objects), "Can not drain to same Queue");
final NodeEngine nodeEngine = getNodeEngine();
Collection<Data> dataList = drainInternal(i);
for (Data data : dataList) {
E e = nodeEngine.toObject(data);
objects.add(e);
}
return dataList.size();
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class QueueProxyImpl method offer.
@Override
public boolean offer(@Nonnull E e, long timeout, @Nonnull TimeUnit timeUnit) throws InterruptedException {
checkNotNull(e, "Null item is not allowed!");
checkNotNull(timeUnit, "Null timeUnit is not allowed!");
final NodeEngine nodeEngine = getNodeEngine();
final Data data = nodeEngine.toData(e);
return offerInternal(data, timeUnit.toMillis(timeout));
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class QueueProxyImpl method remove.
@Override
public boolean remove(@Nonnull Object o) {
checkNotNull(o, "Null item is not allowed!");
final NodeEngine nodeEngine = getNodeEngine();
final Data data = nodeEngine.toData(o);
return removeInternal(data);
}
Aggregations