glassfish-hk2
glassfish-hk2 copied to clipboard
RunLevel of Service Not Considered During Service Narrowing and Injection
Given two run level services that implement the same contract:
@Contract
interface ServiceContract {
}
@Service
@RunLevel(5)
class PrimaryService implements ServiceContract {
}
@Service
@RunLevel(10)
class BackupService implements ServiceContract {
}
If I bring the system to run level 5 I would expect HK2 would consider the run level of the available services and returns an instance of PrimaryService if I try to inject/locate an instance of ServiceContract.
Right now HK2 service locator knows about all the discovered descriptors and during service location the service narrowing logic will return a service based on its natural ordering without any regard for the current run level of the system and the run level of the available services.
Ideally HK2 should return a ServiceContract implementation at or below the current service level.
Environment
Linux 64bit, Java 8
Affected Versions
[2.3.0]
- Issue Imported From: https://github.com/javaee/hk2/issues/298
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @jwells131313
@glassfishrobot Commented Reported by @saden1
@glassfishrobot Commented @saden1 said: Comments, concerns, questions?
@glassfishrobot Commented This issue was imported from java.net JIRA HK2-254