Package net.jcores.jre.utils.internal

Examples of net.jcores.jre.utils.internal.Options.failure()


                } catch (InstantiationException e) {
                    options$.failure(x, e, "spawn:instanceexception:2", "Cannot instantiate.");
                } catch (IllegalAccessException e) {
                    options$.failure(x, e, "spawn:illegalaccess:2", "Unable to access type (2).");
                } catch (InvocationTargetException e) {
                    options$.failure(x, e, "spawn:invocation", "Unable to invoke target.");
                }

                // TODO Make sure to only use weak references, so that we don't run out of memory
                // and prevent
                // garbage colleciton.
View Full Code Here


    public File tempfile(Option... options) {
        try {
            return File.createTempFile("jcores.", ".tmp");
        } catch (IOException e) {
            final Options options$ = Options.$(this.commonCore, options);
            options$.failure(null, e, "tempfile:create", "Unable to create temp file.");
        }

        return new File("/tmp/jcores.failedtmp." + System.nanoTime() + ".tmp");
    }
View Full Code Here

        final File ffile = new File(tempfile(options).getAbsoluteFile() + ".dir/");
       
        // Report if we failed
        if (!ffile.mkdirs()) {
            final Options options$ = Options.$(this.commonCore, options);
            options$.failure(null, null, "tempdir:create", "Unable to create temp dir.");
        }
       
        return ffile;
    }
View Full Code Here

                while (true) {
                    try {
                        f0.f();
                        sleep(delay, options);
                    } catch (Exception e) {
                        options$.failure(f0, e, "manytimes:run", "Exception while executing f().");
                    }

                    // Check if we should terminate
                    if (killswitch != null && killswitch.terminated()) return;
                }
View Full Code Here

                    // Check if we should terminate
                    if (killswitch != null && killswitch.terminated()) return;

                    f0.f();
                } catch (Exception e) {
                    options$.failure(f0, e, "onetime:run", "Exception while executing f().");
                }
            }
        });

        // Register the future
View Full Code Here

                try {
                    final URL url = x.toURL();
                    final InputStream openStream = url.openStream();
                    return openStream;
                } catch (MalformedURLException e) {
                    options$.failure(x, e, "input:urimalformed", "Malformed URI.");
                } catch (IOException e) {
                    options$.failure(x, e, "input:ioerror", "Error opening the URI.");
                }

                return null;
View Full Code Here

                    final InputStream openStream = url.openStream();
                    return openStream;
                } catch (MalformedURLException e) {
                    options$.failure(x, e, "input:urimalformed", "Malformed URI.");
                } catch (IOException e) {
                    options$.failure(x, e, "input:ioerror", "Error opening the URI.");
                }

                return null;
            }
        }).array(InputStream.class));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.