Skip to content

Instantly share code, notes, and snippets.

View ivanursul's full-sized avatar

Ivan Ursul ivanursul

View GitHub Profile
WARN [2015-08-25 18:04:32,716] com.netflix.config.sources.URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
Exception in thread "main" org.apache.commons.configuration.ConversionException: 'graphite.port' doesn't map to an Integer object
at org.apache.commons.configuration.AbstractConfiguration.getInteger(AbstractConfiguration.java:848)
at org.apache.commons.configuration.AbstractConfiguration.getInt(AbstractConfiguration.java:809)
at com.odesk.agora.configuration.ConfigurationFactory.processConfiguration(ConfigurationFactory.java:275)
at com.odesk.agora.configuration.ConfigurationFactory.processConfiguration(ConfigurationFactory.java:400)
at com.odesk.agora.configuration.ConfigurationFactory.build(ConfigurationFactory.java:178)
at com.odesk.agora.command.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:75)
at com.odesk.agora.command.ConfiguredCommand.run(ConfiguredCommand.java:58)
at com.yammer.dropwizard.cli.Cli.run(Cli.java:53)
usage: java -jar service-1.0.0-SNAPSHOT.jar
[-h] [-v] {server,embedded-server,o2server,o2configuration,db} ...
positional arguments:
{server,embedded-server,o2server,o2configuration,db}
available commands
optional arguments:
-h, --help show this help message and exit
-v, --version show the service version and exit
public class Lock{
private boolean isLocked = false;
public synchronized void lock()
throws InterruptedException{
while(isLocked){
wait();
}
isLocked = true;
public class MyWaitNotify{
String myMonitorObject = "";
boolean wasSignalled = false;
public void doWait(){
synchronized(myMonitorObject){
while(!wasSignalled){
try{
myMonitorObject.wait();
public class Main {
private Object lock = new Object();
public void doWait(){
synchronized(lock){
try{
System.out.println("Start waiting");
lock.wait();
System.out.println("End waiting");
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<security:global-method-security pre-post-annotations="enabled" secured-annotations="enabled"/>
@ivanursul
ivanursul / CustomBasicAuthenticationEntryPoint.java
Last active August 29, 2015 14:25
CustomBasicAuthenticationEntryPoint.java for www.ivanursul.com
package org.ivanursul.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
package com.kb.service.order;
import com.kb.domain.company.Company;
import com.kb.domain.enums.CompanyType;
import com.kb.domain.enums.PaymentStatus;
import com.kb.domain.order.Order;
import com.kb.domain.order.OrderStatus;
import com.kb.domain.outlet.Outlet;
import com.kb.repository.order.OrderRepository;
import com.kb.repository.outlet.OutletRepository;
apply plugin: 'java'
apply plugin: 'idea'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile 'joda-time:joda-time:2.3'
package hello;
public class Greeter {
public String sayHello() {
return "Hello world!";
}
}