jcabi-aspects icon indicating copy to clipboard operation
jcabi-aspects copied to clipboard

@Timeable(limit = 1, unit = TimeUnit.SECONDS) not working as expected

Open santoshkumar-soma opened this issue 7 years ago • 6 comments

I have tried to use this annotation with my java method but it not timinout.

Please find the below java method .

public static void main(String[] args) throws InterruptedException{
        test();
    }
    @Loggable
    @Timeable(limit = 1, unit = TimeUnit.SECONDS)
    public static void test() throws InterruptedException{
        System.out.println("Start");
        Thread.sleep(1000000);
        System.out.println("End");
    }

Note: I am using below maven dependancy.

<groupId>com.jcabi</groupId>
        <artifactId>jcabi-maven-plugin</artifactId>
        <version>0.14</version>

santoshkumar-soma avatar Oct 10 '17 20:10 santoshkumar-soma

@yegor256 please, pay attention to this issue

0crat avatar Oct 10 '17 20:10 0crat

@santoshkumar-soma you should not forget about weaving: http://aspects.jcabi.com/example-weaving.html

yegor256 avatar Oct 11 '17 07:10 yegor256

Hi ,

Its not working

public static void main(String[] args) throws InterruptedException{
    test();
}
@Loggable
@Timeable(limit = 1, unit = TimeUnit.SECONDS)
public static void test() throws InterruptedException{
    System.out.println("Start");
    Thread.sleep(1000000);
    System.out.println("End");
}

<dependencies>
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>4.11</version>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>com.jcabi</groupId>
		<artifactId>jcabi-aspects</artifactId>
		<version>0.22.6</version>
	</dependency>
	<dependency>
		<groupId>org.aspectj</groupId>
		<artifactId>aspectjrt</artifactId>
		<version>1.6.12</version>
		<scope>runtime</scope>
	</dependency>
</dependencies>

knmuni avatar Mar 07 '19 04:03 knmuni

Experiencing same issue, anyone found a solution? I have tried adding the jcabi-maven-plugin as well.

gbham avatar Nov 25 '20 11:11 gbham

@gbham Can you provide a small reproducible it case familiar to https://github.com/jcabi/jcabi-aspects/tree/master/src/it/loggable to confirm this bug on the current master?

andreoss avatar May 21 '21 18:05 andreoss

I have long lost interest in using this method for timeouts.

gbham avatar May 22 '21 10:05 gbham