本文整理汇总了Java中com.codahale.metrics.annotation.Counted类的典型用法代码示例。如果您正苦于以下问题:Java Counted类的具体用法?Java Counted怎么用?Java Counted使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Counted类属于com.codahale.metrics.annotation包,在下文中一共展示了Counted类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTicketGrantingTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@Audit(
action="TICKET_GRANTING_TICKET",
actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER",
resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "CREATE_TICKET_GRANTING_TICKET_TIMER")
@Metered(name = "CREATE_TICKET_GRANTING_TICKET_METER")
@Counted(name="CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public TicketGrantingTicket createTicketGrantingTicket(final AuthenticationContext context)
throws AuthenticationException, AbstractTicketException {
final Authentication authentication = context.getAuthentication();
final TicketGrantingTicketFactory factory = this.ticketFactory.get(TicketGrantingTicket.class);
final TicketGrantingTicket ticketGrantingTicket = factory.create(authentication);
this.ticketRegistry.addTicket(ticketGrantingTicket);
doPublishEvent(new CasTicketGrantingTicketCreatedEvent(this, ticketGrantingTicket));
return ticketGrantingTicket;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:CentralAuthenticationServiceImpl.java
示例2: destroyTicketGrantingTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
/**
* {@inheritDoc}
* Destroy a TicketGrantingTicket and perform back channel logout. This has the effect of invalidating any
* Ticket that was derived from the TicketGrantingTicket being destroyed. May throw an
* {@link IllegalArgumentException} if the TicketGrantingTicket ID is null.
*
* @param ticketGrantingTicketId the id of the ticket we want to destroy
* @return the logout requests.
*/
@Audit(
action="TICKET_GRANTING_TICKET_DESTROYED",
actionResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOLVER",
resourceResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "DESTROY_TICKET_GRANTING_TICKET_TIMER")
@Metered(name="DESTROY_TICKET_GRANTING_TICKET_METER")
@Counted(name="DESTROY_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public List<LogoutRequest> destroyTicketGrantingTicket(@NotNull final String ticketGrantingTicketId) {
try {
logger.debug("Removing ticket [{}] from registry...", ticketGrantingTicketId);
final TicketGrantingTicket ticket = getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
logger.debug("Ticket found. Processing logout requests and then deleting the ticket...");
final List<LogoutRequest> logoutRequests = logoutManager.performLogout(ticket);
this.ticketRegistry.deleteTicket(ticketGrantingTicketId);
return logoutRequests;
} catch (final InvalidTicketException e) {
logger.debug("TicketGrantingTicket [{}] cannot be found in the ticket registry.", ticketGrantingTicketId);
}
return Collections.emptyList();
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:31,代码来源:CentralAuthenticationServiceImpl.java
示例3: grantServiceTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@Audit(
action="SERVICE_TICKET",
actionResolverName="GRANT_SERVICE_TICKET_RESOLVER",
resourceResolverName="GRANT_SERVICE_TICKET_RESOURCE_RESOLVER")
@Timed(name = "GRANT_SERVICE_TICKET_TIMER")
@Metered(name="GRANT_SERVICE_TICKET_METER")
@Counted(name="GRANT_SERVICE_TICKET_COUNTER", monotonic=true)
@Override
public ServiceTicket grantServiceTicket(final String ticketGrantingTicketId,
final Service service) throws TicketException {
try {
return this.grantServiceTicket(ticketGrantingTicketId, service, (Credential[]) null);
} catch (final AuthenticationException e) {
throw new IllegalStateException("Unexpected authentication exception", e);
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:CentralAuthenticationServiceImpl.java
示例4: getTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Timed(name = "GET_TICKET_TIMER")
@Metered(name = "GET_TICKET_METER")
@Counted(name="GET_TICKET_COUNTER", monotonic=true)
@Override
public <T extends Ticket> T getTicket(final String ticketId, final Class<? extends Ticket> clazz)
throws InvalidTicketException {
Assert.notNull(ticketId, "ticketId cannot be null");
final Ticket ticket = this.ticketRegistry.getTicket(ticketId, clazz);
if (ticket == null) {
logger.debug("Ticket [{}] by type [{}] cannot be found in the ticket registry.", ticketId, clazz.getSimpleName());
throw new InvalidTicketException(ticketId);
}
if (ticket instanceof TicketGrantingTicket) {
synchronized (ticket) {
if (ticket.isExpired()) {
this.ticketRegistry.deleteTicket(ticketId);
logger.debug("Ticket [{}] has expired and is now deleted from the ticket registry.", ticketId);
throw new InvalidTicketException(ticketId);
}
}
}
return (T) ticket;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:29,代码来源:CentralAuthenticationServiceImpl.java
示例5: authenticate
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@Override
@Audit(
action = "AUTHENTICATION",
actionResolverName = "AUTHENTICATION_RESOLVER",
resourceResolverName = "AUTHENTICATION_RESOURCE_RESOLVER")
@Timed(name = "AUTHENTICATE_TIMER")
@Metered(name = "AUTHENTICATE_METER")
@Counted(name = "AUTHENTICATE_COUNT", monotonic = true)
public Authentication authenticate(final AuthenticationTransaction transaction) throws AuthenticationException {
AuthenticationCredentialsLocalBinder.bindCurrent(transaction.getCredentials());
final AuthenticationBuilder builder = authenticateInternal(transaction);
final Authentication authentication = builder.build();
final Principal principal = authentication.getPrincipal();
if (principal instanceof NullPrincipal) {
throw new UnresolvedPrincipalException(authentication);
}
addAuthenticationMethodAttribute(builder, authentication);
LOGGER.info("Authenticated principal [{}] with attributes [{}] via credentials [{}].",
principal.getId(), principal.getAttributes(), transaction.getCredentials());
populateAuthenticationMetadataAttributes(builder, transaction);
final Authentication a = builder.build();
AuthenticationCredentialsLocalBinder.bindCurrent(a);
return a;
}
示例6: authenticate
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@Override
@Audit(
action="AUTHENTICATION",
actionResolverName="AUTHENTICATION_RESOLVER",
resourceResolverName="AUTHENTICATION_RESOURCE_RESOLVER")
@Timed(name="AUTHENTICATE_TIMED")
@Metered(name="AUTHENTICATE_METER")
@Counted(name="AUTHENTICATE_COUNT", monotonic=true)
public Authentication authenticate(final AuthenticationTransaction transaction) throws AuthenticationException {
final AuthenticationBuilder builder = authenticateInternal(transaction.getCredentials());
final Authentication authentication = builder.build();
final Principal principal = authentication.getPrincipal();
if (principal instanceof NullPrincipal) {
throw new UnresolvedPrincipalException(authentication);
}
addAuthenticationMethodAttribute(builder, authentication);
logger.info("Authenticated {} with credentials {}.", principal, transaction.getCredentials());
logger.debug("Attribute map for {}: {}", principal.getId(), principal.getAttributes());
populateAuthenticationMetadataAttributes(builder, transaction.getCredentials());
return builder.build();
}
示例7: getTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* Note:
* Synchronization on ticket object in case of cache based registry doesn't serialize
* access to critical section. The reason is that cache pulls serialized data and
* builds new object, most likely for each pull. Is this synchronization needed here?
*/
@Timed(name = "GET_TICKET_TIMER")
@Metered(name = "GET_TICKET_METER")
@Counted(name="GET_TICKET_COUNTER", monotonic=true)
@Override
public <T extends Ticket> T getTicket(final String ticketId, final Class<? extends Ticket> clazz)
throws InvalidTicketException {
Assert.notNull(ticketId, "ticketId cannot be null");
final Ticket ticket = this.ticketRegistry.getTicket(ticketId, clazz);
if (ticket == null) {
logger.debug("Ticket [{}] by type [{}] cannot be found in the ticket registry.", ticketId, clazz.getSimpleName());
throw new InvalidTicketException(ticketId);
}
if (ticket instanceof TicketGrantingTicket) {
synchronized (ticket) {
if (ticket.isExpired()) {
this.ticketRegistry.deleteTicket(ticketId);
logger.debug("Ticket [{}] has expired and is now deleted from the ticket registry.", ticketId);
throw new InvalidTicketException(ticketId);
}
}
}
return (T) ticket;
}
示例8: destroyTicketGrantingTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
/**
* {@inheritDoc}
* Destroy a TicketGrantingTicket and perform back channel logout. This has the effect of invalidating any
* Ticket that was derived from the TicketGrantingTicket being destroyed. May throw an
* {@link IllegalArgumentException} if the TicketGrantingTicket ID is null.
*
* @param ticketGrantingTicketId the id of the ticket we want to destroy
* @return the logout requests.
*/
@Audit(
action="TICKET_GRANTING_TICKET_DESTROYED",
actionResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOLVER",
resourceResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "DESTROY_TICKET_GRANTING_TICKET_TIMER")
@Metered(name="DESTROY_TICKET_GRANTING_TICKET_METER")
@Counted(name="DESTROY_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public List<LogoutRequest> destroyTicketGrantingTicket(@NotNull final String ticketGrantingTicketId) {
try {
logger.debug("Removing ticket [{}] from registry...", ticketGrantingTicketId);
final TicketGrantingTicket ticket = getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
logger.debug("Ticket found. Processing logout requests and then deleting the ticket...");
final List<LogoutRequest> logoutRequests = logoutManager.performLogout(ticket);
this.ticketRegistry.deleteTicket(ticketGrantingTicketId);
doPublishEvent(new CasTicketGrantingTicketDestroyedEvent(this, ticket));
return logoutRequests;
} catch (final InvalidTicketException e) {
logger.debug("TicketGrantingTicket [{}] cannot be found in the ticket registry.", ticketGrantingTicketId);
}
return Collections.emptyList();
}
示例9: addDevice
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@Timed(name = "deviceUI-addDevice")
@Counted(name = "deviceUI-Counter")
@RequestMapping(value = "/addDevice", method = RequestMethod.POST)
public
@ResponseBody
void addDevice(@ModelAttribute("devices") List<Device> devices, @RequestBody Device device) {
//Archaius Dynamic Property Loading
Boolean gatherStatistics = dynamicBooleanProperty.get();
if (gatherStatistics) {
requestsAddDeviceMetric.mark();
timerAddDevice.time();
}
String identifier = idGeneratorService.generateIdentifier(serviceUrl() + "/device/idGenerator");
device.setIdentifier(identifier);
devices.add(device);
if (gatherStatistics) { timerAddDevice.time().stop(); };
}
示例10: destroyTicketGrantingTicket
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
/**
* {@inheritDoc}
* Destroy a TicketGrantingTicket and perform back channel logout. This has the effect of invalidating any
* Ticket that was derived from the TicketGrantingTicket being destroyed. May throw an
* {@link IllegalArgumentException} if the TicketGrantingTicket ID is null.
*
* @param ticketGrantingTicketId the id of the ticket we want to destroy
* @return the logout requests.
*/
@Audit(
action="TICKET_GRANTING_TICKET_DESTROYED",
actionResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOLVER",
resourceResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "DESTROY_TICKET_GRANTING_TICKET_TIMER")
@Metered(name="DESTROY_TICKET_GRANTING_TICKET_METER")
@Counted(name="DESTROY_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public List<LogoutRequest> destroyTicketGrantingTicket(@NotNull final String ticketGrantingTicketId) {
try {
logger.debug("Removing ticket [{}] from registry...", ticketGrantingTicketId);
final TicketGrantingTicket ticket = getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
logger.debug("Ticket found. Processing logout requests and then deleting the ticket...");
final List<LogoutRequest> logoutRequests = logoutManager.performLogout(ticket);
this.ticketRegistry.deleteTicket(ticketGrantingTicketId);
return logoutRequests;
} catch (final InvalidTicketException e) {
logger.debug("TicketGrantingTicket [{}] cannot be found in the ticket registry.", ticketGrantingTicketId);
}
return Collections.emptyList();
}
示例11: findAll
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@ApiOperation(value = "Retrieves all AdministrativeUnit ", response = AdministrativeUnit.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "AdministrativeUnit found",
response = AdministrativeUnit.class),
@ApiResponse(code = 404, message = "No AdministrativeUnit found"),
@ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER),
@ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER),
@ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR)})
@Counted
@Timed
@RequestMapping(method = RequestMethod.GET, value = ADMINISTRATIVE_UNIT)
public ResponseEntity<AdministrativeUnitHateoas> findAll(HttpServletRequest request) {
AdministrativeUnitHateoas adminHateoas = new AdministrativeUnitHateoas(
(ArrayList<INikitaEntity>) (ArrayList) administrativeUnitService.findAll());
administrativeUnitHateoasHandler.addLinks(adminHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK)
.allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath()))
.body(adminHateoas);
}
示例12: getAdministrativeUnitTemplate
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@ApiOperation(value = "Creates a suggested AdministrativeUnit", response = AdministrativeUnit.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "AdministrativeUnit codes found",
response = AdministrativeUnit.class),
@ApiResponse(code = 404, message = "No AdministrativeUnit found"),
@ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER),
@ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER),
@ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR)})
@Counted
@Timed
@RequestMapping(method = RequestMethod.GET, value = NEW_ADMINISTRATIVE_UNIT)
public ResponseEntity<AdministrativeUnitHateoas> getAdministrativeUnitTemplate(HttpServletRequest request) {
AdministrativeUnit administrativeUnit = new AdministrativeUnit();
administrativeUnit.setShortName("kortnavn på administrativtenhet");
administrativeUnit.setAdministrativeUnitName("Formell navn på administrativtenhet");
AdministrativeUnitHateoas adminHateoas = new AdministrativeUnitHateoas(administrativeUnit);
return ResponseEntity.status(HttpStatus.OK)
.allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath()))
.body(adminHateoas);
}
示例13: findOneRegistryEntrybySystemId
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@ApiOperation(value = "Retrieves a single RegistryEntry entity given a systemId", response = RegistryEntry.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "RegistryEntry returned", response = RegistryEntry.class),
@ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER),
@ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER),
@ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR)})
@Counted
@Timed
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.GET)
public ResponseEntity<RegistryEntryHateoas> findOneRegistryEntrybySystemId(
HttpServletRequest request,
@ApiParam(name = "systemID",
value = "systemID of the registryEntry to retrieve",
required = true)
@PathVariable("systemID") final String registryEntrySystemId) {
RegistryEntry registryEntry = registryEntryService.findBySystemIdOrderBySystemId(registryEntrySystemId);
RegistryEntryHateoas registryEntryHateoas = new
RegistryEntryHateoas(registryEntry);
registryEntryHateoasHandler.addLinks(registryEntryHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK)
.allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath()))
.eTag(registryEntry.getVersion().toString())
.body(registryEntryHateoas);
}
示例14: ignore
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@ApiOperation(value = "Retrieves multiple RegistryEntry entities limited by ownership rights", notes = "The field skip" +
"tells how many RegistryEntry rows of the result set to ignore (starting at 0), while top tells how many rows" +
" after skip to return. Note if the value of top is greater than system value " +
" nikita-noark5-core.pagination.maxPageSize, then nikita-noark5-core.pagination.maxPageSize is used. ",
response = RegistryEntryHateoas.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "RegistryEntry found",
response = RegistryEntryHateoas.class),
@ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER),
@ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER),
@ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR)})
@Counted
@Timed
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<RegistryEntryHateoas> findAllRegistryEntry(
HttpServletRequest request,
@RequestParam(name = "top", required = false) Integer top,
@RequestParam(name = "skip", required = false) Integer skip) {
RegistryEntryHateoas registryEntryHateoas = new
RegistryEntryHateoas((ArrayList<INikitaEntity>) (ArrayList)
registryEntryService.findRegistryEntryByOwnerPaginated(top, skip));
registryEntryHateoasHandler.addLinks(registryEntryHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK)
.allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath()))
.body(registryEntryHateoas);
}
示例15: entity
import com.codahale.metrics.annotation.Counted; //导入依赖的package包/类
@ApiOperation(value = "Deletes a single RegistryEntry entity identified by systemID", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Parent entity (DocumentDescription or Record) returned", response = String.class),
@ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER),
@ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER),
@ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR)})
@Counted
@Timed
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS,
method = RequestMethod.DELETE)
public ResponseEntity<String> deleteRecordBySystemId(HttpServletRequest request,
@ApiParam(name = "systemID",
value = "systemID of the record to delete",
required = true)
@PathVariable("systemID") final String systemID) {
RegistryEntry registryEntry = registryEntryService.findBySystemIdOrderBySystemId(systemID);
registryEntryService.deleteEntity(systemID);
applicationEventPublisher.publishEvent(new AfterNoarkEntityDeletedEvent(this, registryEntry));
return ResponseEntity.status(HttpStatus.OK)
.allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath()))
.body(CommonUtils.WebUtils.getSuccessStatusStringForDelete());
}