glassfish-hk2 icon indicating copy to clipboard operation
glassfish-hk2 copied to clipboard

RunLevel of Service Not Considered During Service Narrowing and Injection

Open glassfishrobot opened this issue 9 years ago • 4 comments

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]

glassfishrobot avatar May 26 '15 17:05 glassfishrobot

  • Issue Imported From: https://github.com/javaee/hk2/issues/298
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @jwells131313

glassfishrobot avatar Aug 30 '18 09:08 glassfishrobot

@glassfishrobot Commented Reported by @saden1

glassfishrobot avatar May 26 '15 17:05 glassfishrobot

@glassfishrobot Commented @saden1 said: Comments, concerns, questions?

glassfishrobot avatar Jun 11 '15 20:06 glassfishrobot

@glassfishrobot Commented This issue was imported from java.net JIRA HK2-254

glassfishrobot avatar Apr 26 '17 10:04 glassfishrobot