首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏核心思路逻辑

    mongo集群中读写操作与并发

    m.SessionContext) error { opts := &options.TransactionOptions{ReadPreference: readpref.Primary( )} //关键代码,如果事务中全是写入操作,此处不必指定 err := sessionContext.StartTransaction(opts) // 后续的db操作要用事务就用 sessionContext // 不用事务就用ctx,正常情况下,开启事务后,里面的db操作都应该使用事务的sessionContext //err = mongo.MongoDBCurd = nil { _ = sessionContext.AbortTransaction(sessionContext) return err } _ = sessionContext.CommitTransaction(sessionContext) return nil }) 参考文献 https://www.mongodb.com

    33910编辑于 2024-11-27
  • 来自专栏码匠的流水账

    聊聊artemis的callFailoverTimeout

    artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext inClose && mayAttemptToFailover) { sessionContext.recreateSession(username, password consumerInternal.isClosed()) { sessionContext.recreateConsumerOnServer(consumerInternal = null) { sessionContext.xaFailed(currentXID); rollbackOnly (),而handleFailover方法在recreateConsumerOnServer之后的finally里头会执行sessionContext.releaseCommunications() 小结

    62720发布于 2020-02-24
  • 来自专栏码匠的流水账

    聊聊artemis的callFailoverTimeout

    artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext inClose && mayAttemptToFailover) { sessionContext.recreateSession(username, password consumerInternal.isClosed()) { sessionContext.recreateConsumerOnServer(consumerInternal = null) { sessionContext.xaFailed(currentXID); rollbackOnly (),而handleFailover方法在recreateConsumerOnServer之后的finally里头会执行sessionContext.releaseCommunications() 小结

    37100发布于 2020-02-17
  • 来自专栏码匠的流水账

    聊聊artemis的ClientProducerCredits

    sessionContext); ​ void reset(); ​ void close(); ​ void incrementRefCount(); ​ int decrementRefCount arriving; ​ private int refCount; ​ protected boolean serverRespondedWithFail; ​ protected SessionContext public SimpleString getAddress() { return address; } ​ @Override public void init(SessionContext sessionContext) { // We initial request twice as many credits as we request in subsequent requests = sessionContext; ​ this.sessionContext.linkFlowControl(address, this); } ​ @Override

    42700发布于 2020-01-14
  • 来自专栏码匠的流水账

    聊聊artemis的SessionProducerCreditsMessage

    // We can only log these exceptions // maybe we should cache it on SessionContext 的handleReceiveProducerCredits方法 SessionContext activemq-artemis-2.11.0/artemis-core-client/src/main/java /org/apache/activemq/artemis/spi/core/remoting/SessionContext.java public abstract class SessionContext 做不同的处理,当type为SESS_PRODUCER_CREDITS时执行handleReceiveProducerCredits方法;handleReceiveProducerCredits调用的是父类SessionContext 的handleReceiveProducerCredits方法;SessionContext的handleReceiveProducerCredits方法执行的是ClientSessionInternal

    58100发布于 2020-01-15
  • 来自专栏码匠的流水账

    聊聊artemis的confirmationWindowEnabled

    // server's on which case we can't' convert the message into large at the servers if (sessionContext.supportsLargeMessage (msgI); ​ theCredits.acquireCredits(creditSize); ​ sessionContext.sendFullMessage(msgI, sendBlocking } ​ //...... ​ } doSend方法最后执行的是largeMessageSend或者sendRegularMessage方法,而sendRegularMessage方法最后执行的是sessionContext.sendFullMessage artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext

    78500发布于 2020-01-23
  • 来自专栏码匠的流水账

    聊聊artemis的individualAcknowledge

    preAcknowledge) { return; } ​ checkClosed(); ​ startCall(); try { ​ sessionContext.sendACK finally { endCall(); } } ​ //...... } ClientSessionImpl的individualAcknowledge方法通过sessionContext.sendACK 来发送ack sessionContext.sendACK activemq-artemis-2.11.0/artemis-core-client/src/main/java/org/apache/activemq artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext lastAckedMessage不为null的先执行flushAcks,最后执行session.individualAcknowledge;ClientSessionImpl的individualAcknowledge方法通过sessionContext.sendACK

    79900发布于 2020-02-01
  • 来自专栏云原生拾遗

    180行代码实现全球短信发送功能(无SKD依赖)

    templateParam 假如模板中存在变量需要替换则为必填项 * @param string $extendCode 可选项,7位上行短信扩展码 * @param string $sessionContext 携带上下文信息,server 会原样返回 */ public function send($phoneNumbers, $templateParam, $extendCode = '', $sessionContext ]; if ($extendCode) { $data['ExtendCode'] = $extendCode; } if ($sessionContext ) { $data['SessionContext'] = $sessionContext; } return $this->post('ap-guangzhou

    18.4K112编辑于 2023-08-12
  • 来自专栏码匠的流水账

    聊聊artemis的individualAcknowledge

    preAcknowledge) { return; } checkClosed(); startCall(); try { sessionContext.sendACK finally { endCall(); } } //...... } ClientSessionImpl的individualAcknowledge方法通过sessionContext.sendACK 来发送ack sessionContext.sendACK activemq-artemis-2.11.0/artemis-core-client/src/main/java/org/apache/activemq artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext lastAckedMessage不为null的先执行flushAcks,最后执行session.individualAcknowledge;ClientSessionImpl的individualAcknowledge方法通过sessionContext.sendACK

    57320发布于 2020-02-24
  • 来自专栏朱永胜的私房菜

    记一下Shiro重构之ShiroSessionFactory

    lombok.extern.slf4j.Slf4j; import org.apache.shiro.session.Session; import org.apache.shiro.session.mgt.SessionContext @author zhuyongsheng * @date 2019/8/15 */ @Override public Session createSession(SessionContext

    24620编辑于 2023-08-17
  • 来自专栏码匠的流水账

    聊聊artemis的handleConnectionFailure

    ActiveMQClientLogger.LOGGER.failoverOrReconnect(connectionID, me); ​ for (ClientSessionInternal session : sessions) { SessionContext session.getSessionContext(); if (context instanceof ActiveMQSessionContext) { ActiveMQSessionContext sessionContext = (ActiveMQSessionContext) context; if (sessionContext.isKilled()) { setReconnectAttempts } } } ​ //...... } handleConnectionFailure方法会调用failoverOrReconnect方法,该方法会先遍历sessions,对于sessionContext.isKilled 来控制重试的间隔 小结 ClientSessionFactoryImpl的handleConnectionFailure方法会调用failoverOrReconnect方法,该方法会先遍历sessions,对于sessionContext.isKilled

    54500发布于 2020-02-18
  • 来自专栏后端开发

    抽象 Jalo 层类的本质与 JVM 字节码剖析

    对每个属性生成 getName(SessionContext ctx)、setName(String value) 及无 SessionContext 的便捷重载,内部调用 getProperty(ctx #83 // Method de/hybris/platform/jalo/JaloSession.getSessionContext:()Lde/hybris/platform/jalo/SessionContext ; 6: invokevirtual #90 // Method getProperty:(Lde/hybris/platform/jalo/SessionContext;Ljava/lang Getter 链路涉及一次 SessionContext 查找和一次 HashMap 查询,Service Layer 则可借助 ModelCache 减少锁竞争 (SAP Community, expertshybris.com

    21810编辑于 2025-05-21
  • 来自专栏码匠的流水账

    聊聊artemis的handleConnectionFailure

    ActiveMQClientLogger.LOGGER.failoverOrReconnect(connectionID, me); for (ClientSessionInternal session : sessions) { SessionContext session.getSessionContext(); if (context instanceof ActiveMQSessionContext) { ActiveMQSessionContext sessionContext = (ActiveMQSessionContext) context; if (sessionContext.isKilled()) { setReconnectAttempts } } } //...... } handleConnectionFailure方法会调用failoverOrReconnect方法,该方法会先遍历sessions,对于sessionContext.isKilled 来控制重试的间隔 小结 ClientSessionFactoryImpl的handleConnectionFailure方法会调用failoverOrReconnect方法,该方法会先遍历sessions,对于sessionContext.isKilled

    41610发布于 2020-02-24
  • 来自专栏SDNLAB

    ODL源码分析之flowmod下发流程

    这两个方法主要是操作HashMap即ConcurrentHashMap<SwitchSessionKeyOF, SessionContext> sessionLot。 3.Hashmap中键值value是SessionContext,这个上下文包含了一个ModelDrivenSwitchImpl,实则是ODL对交换机的抽象。 抽象出来的ModelDrivenSwitchImpl进行再次包装,插入到SessionContext的notifaction队列当中。以便能够处理后续的notification消息。 4.在ModelDrivenSwitchImpl中有一个属性OFRpcTaskContext,这个属性是关联SessionContext以及Notification服务等。

    88470发布于 2018-04-02
  • 来自专栏MongoDB中文社区

    一文读懂 驱动程序 API

    callback := func(sessCtx mongo.SessionContext) (interface{}, error) { // Important: You must pass runTransactionWithRetry := func(sctx mongo.SessionContext , txnFn func(mongo.SessionContext) error) error { for { err := txnFn(sctx) // Performs transaction continue } return err } } commitWithRetry := func(sctx mongo.SessionContext) error { updateEmployeeInfo := func(sctx mongo.SessionContext) error { employees := client.Database("hr").Collection

    1.9K10编辑于 2022-03-08
  • 来自专栏FunTester

    mock延迟响应的接口

    com.github.dreamhead.moco.handler.AbstractResponseHandler import com.github.dreamhead.moco.internal.SessionContext DelayHandler(handler, time); } /** * * @param context */ @Override void writeToResponse(SessionContext

    1.2K10发布于 2020-06-04
  • 来自专栏全栈程序员必看

    java session id 生成_Java通过sessionId获取Session「建议收藏」

    Servlet2.1之后不支持SessionContext里面getSession(String id)方法。 但是,我们可以通过HttpSessionListener监听器和全局静态map自己实现一个SessionContext

    3.1K40编辑于 2022-09-13
  • 来自专栏码匠的流水账

    聊聊artemis的confirmationWindowEnabled

    // server's on which case we can't' convert the message into large at the servers if (sessionContext.supportsLargeMessage (msgI); theCredits.acquireCredits(creditSize); sessionContext.sendFullMessage(msgI, sendBlocking } //...... } doSend方法最后执行的是largeMessageSend或者sendRegularMessage方法,而sendRegularMessage方法最后执行的是sessionContext.sendFullMessage artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext artemis/core/protocol/core/impl/ActiveMQSessionContext.java public class ActiveMQSessionContext extends SessionContext

    75830发布于 2020-02-24
  • 来自专栏码匠的流水账

    聊聊artemis的ClientProducerCreditManager

    ClientProducerCreditManager { ​ ClientProducerCredits getCredits(SimpleString address, boolean anon, SessionContext final boolean anon, SessionContext public boolean isBlocked() { return false; } ​ @Override public void init(SessionContext

    36300发布于 2020-01-13
  • 来自专栏山行AI

    shiro中改造成restful无状态服务的DisabledSessionException问题分析与解决

    DisabledSessionException(msg); } log.trace("Starting session for host {}", getHost()); SessionContext sessionContext = createSessionContext(); Session session = this.securityManager.start(sessionContext

    2.6K10发布于 2019-12-02
领券