當前位置: 首頁>>代碼示例>>Java>>正文


Java Encoder.hexDecode方法代碼示例

本文整理匯總了Java中org.voltdb.utils.Encoder.hexDecode方法的典型用法代碼示例。如果您正苦於以下問題:Java Encoder.hexDecode方法的具體用法?Java Encoder.hexDecode怎麽用?Java Encoder.hexDecode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.voltdb.utils.Encoder的用法示例。


在下文中一共展示了Encoder.hexDecode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initSQLStmt

import org.voltdb.utils.Encoder; //導入方法依賴的package包/類
public void initSQLStmt(SQLStmt stmt, Statement catStmt) {

        int fragCount = catStmt.getFragments().size();

        for (PlanFragment frag : catStmt.getFragments()) {
            byte[] planHash = Encoder.hexDecode(frag.getPlanhash());
            byte[] plan = Encoder.decodeBase64AndDecompressToBytes(frag.getPlannodetree());
            long id = ActivePlanRepository.loadOrAddRefPlanFragment(planHash, plan, catStmt.getSqltext());
            boolean transactional = frag.getNontransactional() == false;

            SQLStmt.Frag stmtFrag = new SQLStmt.Frag(id, planHash, transactional);

            if (fragCount == 1 || frag.getHasdependencies()) {
                stmt.aggregator = stmtFrag;
            }
            else {
                stmt.collector = stmtFrag;
            }
        }

        stmt.isReadOnly = catStmt.getReadonly();
        stmt.isReplicatedTableDML = catStmt.getReplicatedtabledml();

        stmt.site = m_site;

        int numStatementParamJavaTypes = catStmt.getParameters().size();
        stmt.statementParamJavaTypes = new byte[numStatementParamJavaTypes];
        for (StmtParameter param : catStmt.getParameters()) {
            stmt.statementParamJavaTypes[param.getIndex()] = (byte)param.getJavatype();
            // ??? How does the SQLStmt successfully handle IN LIST queries without
            // caching the value of param.getIsarray() here?
            // Is the array-ness also reflected in the javatype? --paul
        }
    }
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:35,代碼來源:ProcedureRunner.java

示例2: dispatchUpdateApplicationCatalog

import org.voltdb.utils.Encoder; //導入方法依賴的package包/類
ClientResponseImpl dispatchUpdateApplicationCatalog(StoredProcedureInvocation task,
        ClientInputHandler handler, Connection ccxn, AuthSystem.AuthUser user)
{
    ParameterSet params = task.getParams();
    // default catalogBytes to null, when passed along, will tell the
    // catalog change planner that we want to use the current catalog.
    byte[] catalogBytes = null;
    Object catalogObj = params.toArray()[0];
    if (catalogObj != null) {
        if (catalogObj instanceof String) {
            // treat an empty string as no catalog provided
            String catalogString = (String) catalogObj;
            if (!catalogString.isEmpty()) {
                catalogBytes = Encoder.hexDecode(catalogString);
            }
        } else if (catalogObj instanceof byte[]) {
            // treat an empty array as no catalog provided
            byte[] catalogArr = (byte[]) catalogObj;
            if (catalogArr.length != 0) {
                catalogBytes = catalogArr;
            }
        }
    }
    String deploymentString = (String) params.toArray()[1];
    LocalObjectMessage work = new LocalObjectMessage(
            new CatalogChangeWork(
                m_siteId,
                task.clientHandle, handler.connectionId(), ccxn.getHostnameAndIPAndPort(),
                handler.isAdmin(), ccxn, catalogBytes, deploymentString,
                task.procName, task.type, task.originalTxnId, task.originalUniqueId,
                VoltDB.instance().getReplicationRole() == ReplicationRole.REPLICA,
                VoltDB.instance().getCatalogContext().cluster.getUseddlschema(),
                m_adhocCompletionHandler, user));

    m_mailbox.send(m_plannerSiteId, work);
    return null;
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:38,代碼來源:ClientInterface.java

示例3: getParameterObjects

import org.voltdb.utils.Encoder; //導入方法依賴的package包/類
public Object[] getParameterObjects() throws SQLParser.Exception
{
    Object[] objectParams = new Object[this.params.size()];
    int i = 0;
    try {
        for (; i < this.params.size(); i++) {
            String paramType = this.paramTypes.get(i);
            String param = this.params.get(i);
            Object objParam = null;
            // For simplicity, handle first the types that don't allow null as a special value.
            if (paramType.equals("bit")) {
                //TODO: upper/mixed case Yes and True should be treated as "1"?
                //TODO: non-0 integers besides 1 should be treated as "1"?
                //TODO: garbage values and null should be rejected, not accepted as "0":
                //      (case-insensitive) "no"/"false"/"0" should be required for "0"?
                if (param.equals("yes") || param.equals("true") || param.equals("1")) {
                    objParam = (byte)1;
                } else {
                    objParam = (byte)0;
                }
            }
            else if (paramType.equals("statisticscomponent") ||
                     paramType.equals("sysinfoselector") ||
                     paramType.equals("metadataselector")) {
                objParam = preprocessParam(param);
            }
            else if ( ! "null".equalsIgnoreCase(param)) {
                if (paramType.equals("tinyint")) {
                    objParam = Byte.parseByte(param);
                }
                else if (paramType.equals("smallint")) {
                    objParam = Short.parseShort(param);
                }
                else if (paramType.equals("int") || paramType.equals("integer")) {
                    objParam = Integer.parseInt(param);
                }
                else if (paramType.equals("bigint")) {
                    objParam = Long.parseLong(param);
                }
                else if (paramType.equals("float")) {
                    objParam = Double.parseDouble(param);
                }
                else if (paramType.equals("varchar")) {
                    objParam = Unquote.matcher(param).replaceAll("").replace("''","'");
                }
                else if (paramType.equals("decimal")) {
                    objParam = new BigDecimal(param);
                }
                else if (paramType.equals("timestamp")) {
                    objParam = parseDate(param);
                }
                else if (paramType.equals("varbinary") || paramType.equals("tinyint_array")) {
                    String val = Unquote.matcher(param).replaceAll("");
                    objParam = Encoder.hexDecode(val);
                    // Make sure we have an even number of characters, otherwise it is an invalid byte string
                    if (param.length() % 2 == 1) {
                        throw new SQLParser.Exception(
                                "Invalid varbinary value (%s) (param %d) : "
                                + "must have an even number of hex characters to be valid.",
                                param, i+1);
                    }
                }
                else {
                    throw new SQLParser.Exception("Unsupported Data Type: %s", paramType);
                }
            } // else param is keyword "null", so leave objParam as null.
            objectParams[i] = objParam;
        }
    } catch (NumberFormatException nfe) {
        throw new SQLParser.Exception(nfe,
                "Invalid parameter:  Expected a %s value, got '%s' (param %d).",
                friendlyTypeDescription(this.paramTypes.get(i)), this.params.get(i), i+1);
    }
    return objectParams;
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:76,代碼來源:SQLParser.java

示例4: ClientImpl

import org.voltdb.utils.Encoder; //導入方法依賴的package包/類
/**
 * Create a new client without any initial connections.
 * Also provide a hint indicating the expected serialized size of
 * most outgoing procedure invocations. This helps size initial allocations
 * for serializing network writes
 * @param expectedOutgoingMessageSize Expected size of procedure invocations in bytes
 * @param maxArenaSizes Maximum size arenas in the memory pool should grow to
 * @param heavyweight Whether to use multiple or a single thread
 */
ClientImpl(ClientConfig config) {
    m_distributer = new Distributer(
            config.m_heavyweight,
            config.m_procedureCallTimeoutNanos,
            config.m_connectionResponseTimeoutMS,
            config.m_useClientAffinity,
            config.m_subject);
    m_distributer.addClientStatusListener(m_listener);
    String username = config.m_username;
    if (config.m_subject != null) {
        username = config.m_subject.getPrincipals().iterator().next().getName();
    }
    m_username = username;

    if (config.m_reconnectOnConnectionLoss) {
        m_reconnectStatusListener = new ReconnectStatusListener(this,
                config.m_initialConnectionRetryIntervalMS, config.m_maxConnectionRetryIntervalMS);
        m_distributer.addClientStatusListener(m_reconnectStatusListener);
    } else {
        m_reconnectStatusListener = null;
    }

    if (config.m_cleartext) {
        m_passwordHash = ConnectionUtil.getHashedPassword(config.m_password);
    } else {
        m_passwordHash = Encoder.hexDecode(config.m_password);
    }
    if (config.m_listener != null) {
        m_distributer.addClientStatusListener(config.m_listener);
    }
    assert(config.m_maxOutstandingTxns > 0);
    m_blessedThreadIds.addAll(m_distributer.getThreadIds());
    if (config.m_autoTune) {
        m_distributer.m_rateLimiter.enableAutoTuning(
                config.m_autoTuneTargetInternalLatency);
    }
    else {
        m_distributer.m_rateLimiter.setLimits(
                config.m_maxTransactionsPerSecond, config.m_maxOutstandingTxns);
    }
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:51,代碼來源:ClientImpl.java


注:本文中的org.voltdb.utils.Encoder.hexDecode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。