Search in sources :

Example 31 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class TcpDiscoveryS3IpFinder method key.

/**
 * Gets S3 key for provided address.
 *
 * @param addr Node address.
 * @return Key.
 */
private String key(InetSocketAddress addr) {
    assert addr != null;
    SB sb = new SB();
    sb.a(addr.getAddress().getHostAddress()).a(DELIM).a(addr.getPort());
    return sb.toString();
}
Also used : SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 32 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class GridChangeStateCommandHandler method handleAsync.

/**
 * {@inheritDoc}
 */
@Override
public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest restRest) {
    GridRestChangeStateRequest req = (GridRestChangeStateRequest) restRest;
    final GridFutureAdapter<GridRestResponse> fut = new GridFutureAdapter<>();
    final GridRestResponse res = new GridRestResponse();
    try {
        if (req.command().equals(CLUSTER_CURRENT_STATE)) {
            Boolean currentState = ctx.state().publicApiActiveState(false);
            res.setResponse(currentState);
        } else
            ctx.grid().active(req.active());
        fut.onDone(res);
    } catch (Exception e) {
        SB sb = new SB();
        sb.a(e.getMessage()).a("\n").a("suppressed: \n");
        for (Throwable t : e.getSuppressed()) sb.a(t.getMessage()).a("\n");
        res.setError(sb.toString());
        fut.onDone(res);
    }
    return fut;
}
Also used : GridRestChangeStateRequest(org.apache.ignite.internal.processors.rest.request.GridRestChangeStateRequest) GridRestResponse(org.apache.ignite.internal.processors.rest.GridRestResponse) GridFutureAdapter(org.apache.ignite.internal.util.future.GridFutureAdapter) SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 33 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class GridIntList method toString.

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    SB b = new SB("[");
    for (int i = 0; i < idx; i++) {
        if (i != 0)
            b.a(',');
        b.a(arr[i]);
    }
    b.a(']');
    return b.toString();
}
Also used : SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 34 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class IgniteKernal method ackCacheConfiguration.

/**
 */
private void ackCacheConfiguration() {
    CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration();
    if (cacheCfgs == null || cacheCfgs.length == 0)
        U.warn(log, "Cache is not configured - in-memory data grid is off.");
    else {
        SB sb = new SB();
        HashMap<String, ArrayList<String>> memPlcNamesMapping = new HashMap<>();
        for (CacheConfiguration c : cacheCfgs) {
            String cacheName = U.maskName(c.getName());
            String memPlcName = c.getDataRegionName();
            if (CU.isSystemCache(cacheName))
                memPlcName = "sysMemPlc";
            else if (memPlcName == null && cfg.getDataStorageConfiguration() != null)
                memPlcName = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName();
            if (!memPlcNamesMapping.containsKey(memPlcName))
                memPlcNamesMapping.put(memPlcName, new ArrayList<String>());
            ArrayList<String> cacheNames = memPlcNamesMapping.get(memPlcName);
            cacheNames.add(cacheName);
        }
        for (Map.Entry<String, ArrayList<String>> e : memPlcNamesMapping.entrySet()) {
            sb.a("in '").a(e.getKey()).a("' dataRegion: [");
            for (String s : e.getValue()) sb.a("'").a(s).a("', ");
            sb.d(sb.length() - 2, sb.length()).a("], ");
        }
        U.log(log, "Configured caches [" + sb.d(sb.length() - 2, sb.length()).toString() + ']');
    }
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 35 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class IgniteKernal method ackStart.

/**
 * Prints start info.
 *
 * @param rtBean Java runtime bean.
 */
private void ackStart(RuntimeMXBean rtBean) {
    ClusterNode locNode = localNode();
    if (log.isQuiet()) {
        U.quiet(false, "");
        U.quiet(false, "Ignite node started OK (id=" + U.id8(locNode.id()) + (F.isEmpty(igniteInstanceName) ? "" : ", instance name=" + igniteInstanceName) + ')');
    }
    if (log.isInfoEnabled()) {
        log.info("");
        String ack = "Ignite ver. " + VER_STR + '#' + BUILD_TSTAMP_STR + "-sha1:" + REV_HASH_STR;
        String dash = U.dash(ack.length());
        SB sb = new SB();
        for (GridPortRecord rec : ctx.ports().records()) sb.a(rec.protocol()).a(":").a(rec.port()).a(" ");
        String str = NL + NL + ">>> " + dash + NL + ">>> " + ack + NL + ">>> " + dash + NL + ">>> OS name: " + U.osString() + NL + ">>> CPU(s): " + locNode.metrics().getTotalCpus() + NL + ">>> Heap: " + U.heapSize(locNode, 2) + "GB" + NL + ">>> VM name: " + rtBean.getName() + NL + (igniteInstanceName == null ? "" : ">>> Ignite instance name: " + igniteInstanceName + NL) + ">>> Local node [" + "ID=" + locNode.id().toString().toUpperCase() + ", order=" + locNode.order() + ", clientMode=" + ctx.clientNode() + "]" + NL + ">>> Local node addresses: " + U.addressesAsString(locNode) + NL + ">>> Local ports: " + sb + NL;
        log.info(str);
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridPortRecord(org.apache.ignite.internal.processors.port.GridPortRecord) SB(org.apache.ignite.internal.util.typedef.internal.SB)

Aggregations

SB (org.apache.ignite.internal.util.typedef.internal.SB)70 Map (java.util.Map)10 HashMap (java.util.HashMap)7 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 LinkedHashMap (java.util.LinkedHashMap)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 GridStringBuilder (org.apache.ignite.internal.util.GridStringBuilder)4 InputStreamReader (java.io.InputStreamReader)3 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)3 IgfsLogger (org.apache.ignite.internal.igfs.common.IgfsLogger)3 InputStream (java.io.InputStream)2 InterruptedIOException (java.io.InterruptedIOException)2 LineNumberReader (java.io.LineNumberReader)2 URL (java.net.URL)2 URLConnection (java.net.URLConnection)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 UUID (java.util.UUID)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2