This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.acme.getting.started; | |
import io.quarkus.runtime.QuarkusApplication; | |
import io.quarkus.runtime.annotations.QuarkusMain; | |
import org.jboss.logging.Logger; | |
import javax.inject.Inject; | |
@QuarkusMain | |
public class GreetingApplication implements QuarkusApplication { | |
public static final Logger LOGGER = Logger.getLogger(GreetingApplication.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.acme.getting.started; | |
import io.quarkus.runtime.QuarkusApplication; | |
import io.quarkus.runtime.annotations.QuarkusMain; | |
import org.jboss.logging.Logger; | |
@QuarkusMain | |
public class GreetingApplication implements QuarkusApplication { | |
public static final Logger LOGGER = Logger.getLogger(GreetingApplication.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify; | |
import io.quarkus.runtime.StartupEvent; | |
import org.graalvm.polyglot.*; | |
import javax.enterprise.event.Observes; | |
import javax.ws.rs.*; | |
import javax.ws.rs.core.MediaType; | |
import java.io.IOException; | |
import java.net.URL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify; | |
import org.graalvm.polyglot.*; | |
import javax.ws.rs.*; | |
import javax.ws.rs.core.MediaType; | |
import java.io.IOException; | |
import java.net.URL; | |
@Path("/cooling") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify; | |
import org.graalvm.polyglot.Context; | |
import org.graalvm.polyglot.Source; | |
import org.graalvm.polyglot.Value; | |
import javax.ws.rs.POST; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.donau.quarkify; | |
import org.graalvm.polyglot.Context; | |
import org.graalvm.polyglot.Source; | |
import org.graalvm.polyglot.Value; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def as_html(func): | |
def wrapper(): | |
result = func() | |
return f'<html>{result}</html>' | |
return wrapper | |
def say_hello(): | |
return 'Hello' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
@Retention(RetentionPolicy.RUNTIME) | |
@interface Cached { } // Nothing inside our annotation | |
static class SomeObject { | |
@Cached | |
public String intensiveTask() throws InterruptedException { | |
Thread.sleep(1000); | |
return "expensive task result"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
cached_items = {} | |
def cached(func): | |
def wrapper(*args, **kwargs): | |
global cached_item | |
if func.__name__ not in cached_items: | |
cached_items[func.__name__] = func(*args, **kwargs) | |
return cached_items[func.__name__] | |
return wrapper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def as_html(func): | |
def wrapper(): | |
result = func() | |
return f'<html>{result}</html>' | |
return wrapper | |
@as_html | |
def say_hello(): | |
return 'Hello' |