mirror of
https://github.com/corda/corda.git
synced 2025-06-22 17:09:00 +00:00
Revert constraint on registerProtocolInitiator()
Revert constraint on registerProtocolInitiator(), as there may be cases that need it to not be a ProtocolLogic. Added note to explain it's normally a ProtocolLogic but not always.
This commit is contained in:
@ -114,7 +114,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, val networkMap
|
|||||||
return smm.add(loggerName, logic).resultFuture
|
return smm.add(loggerName, logic).resultFuture
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <P : ProtocolLogic<*>> registerProtocolInitiator(markerClass: KClass<out P>, protocolFactory: (Party) -> ProtocolLogic<*>) {
|
override fun registerProtocolInitiator(markerClass: KClass<*>, protocolFactory: (Party) -> ProtocolLogic<*>) {
|
||||||
require(markerClass !in protocolFactories) { "${markerClass.java.name} has already been used to register a protocol" }
|
require(markerClass !in protocolFactories) { "${markerClass.java.name} has already been used to register a protocol" }
|
||||||
log.debug { "Registering ${markerClass.java.name}" }
|
log.debug { "Registering ${markerClass.java.name}" }
|
||||||
protocolFactories[markerClass.java] = protocolFactory
|
protocolFactories[markerClass.java] = protocolFactory
|
||||||
|
@ -76,12 +76,12 @@ abstract class ServiceHubInternal : ServiceHub {
|
|||||||
* marker class has been registered then the corresponding factory will be used to create the protocol which will
|
* marker class has been registered then the corresponding factory will be used to create the protocol which will
|
||||||
* communicate with the other side. If there is no mapping then the session attempt is rejected.
|
* communicate with the other side. If there is no mapping then the session attempt is rejected.
|
||||||
* @param markerClass The marker [KClass] present in a session initiation attempt, which is a 1:1 mapping to a [Class]
|
* @param markerClass The marker [KClass] present in a session initiation attempt, which is a 1:1 mapping to a [Class]
|
||||||
* using the <pre>::class</pre> construct. Any marker class can be used, with the default being the class of the initiating
|
* using the <pre>::class</pre> construct. Conventionally this is a [ProtocolLogic] subclass, however any class can
|
||||||
* protocol. This enables the registration to be of the form: registerProtocolInitiator(InitiatorProtocol::class, ::InitiatedProtocol)
|
* be used, with the default being the class of the initiating protocol. This enables the registration to be of the
|
||||||
|
* form: registerProtocolInitiator(InitiatorProtocol::class, ::InitiatedProtocol)
|
||||||
* @param protocolFactory The protocol factory generating the initiated protocol.
|
* @param protocolFactory The protocol factory generating the initiated protocol.
|
||||||
* @param R the return type of the protocol logic
|
|
||||||
*/
|
*/
|
||||||
abstract fun <P : ProtocolLogic<*>> registerProtocolInitiator(markerClass: KClass<out P>, protocolFactory: (Party) -> ProtocolLogic<*>)
|
abstract fun registerProtocolInitiator(markerClass: KClass<*>, protocolFactory: (Party) -> ProtocolLogic<*>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the protocol factory that has been registered with [markerClass], or null if no factory is found.
|
* Return the protocol factory that has been registered with [markerClass], or null if no factory is found.
|
||||||
|
@ -75,7 +75,7 @@ open class MockServiceHubInternal(
|
|||||||
return smm.add(loggerName, logic).resultFuture
|
return smm.add(loggerName, logic).resultFuture
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <P : ProtocolLogic<*>> registerProtocolInitiator(markerClass: KClass<out P>, protocolFactory: (Party) -> ProtocolLogic<*>) {
|
override fun registerProtocolInitiator(markerClass: KClass<*>, protocolFactory: (Party) -> ProtocolLogic<*>) {
|
||||||
protocolFactories[markerClass.java] = protocolFactory
|
protocolFactories[markerClass.java] = protocolFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user